Can't retrieve user metadata in Swift

I’m trying to retrieve the user_metadata with the Auth0.swift toolkit but i have a problem.
I’m using the following example that appear in the documentation:

.users(token: idToken)
.get(“user identifier”, fields: [“user_metadata”], include: true)
.start { result in
switch result {
case .success(let userInfo):
print(“user: (userInfo)”)
case .failure(let error):

But throws me this:

“Failed with unknown error [“attributes”: {
error = “Invalid token”;
}, “message”: Invalid token, “statusCode”: 401, “error”: Unauthorized]”

The token i’m using is the one thats is in the credentials returned from login.
Any suggestions? Thanks!

:wave: @Eros

Would it be possible for you to share the snippet of code where you are making the authentication? It’ll help in solving your issue.

If you are trying to get metadata on the client side you’ll need to add it to your idToken by adding it in a rule

In addition, have you specified the user identifier with id of the user and set the token to have the scope read:users scope?