Getting a 401 while trying to access the api v2 identity endpoint

"{\"errors\":[{\"code\":1,\"code_name\":\"Unauthorized\",\"detail\":\"The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.\",\"id\":\"521196e8-f0d7-5897-b995-f91597907628\",\"status\":\"401\",\"title\":\"Unauthorized\"}]}"

I’m receiving the above messages while trying to pass the access token via header to the /api/oauth2/v2/identity endpoint.

Method: GET
Headers: [“Authorization: Bearer #{token}”]

The language is Elixir, I can post some code if needed. I’ve made it through the OAuth2 workflow and can get an access token. Passing this access token or my creator access token doesn’t seem to work.

Any help is appreciated!


Unauthorized does not only result from incorrect tokens. It can also result from your call trying to access a resource that the token does not have a scope for. Ie email etc. You must ask permission for that resource from the user during the authorization process before token is created.

If this is your creator token, that’s different.

I’m not specifying any scopes in the call, is the scope required to successfully run the call?

You dont have to specify the scopes in the call, but you have to specify the includes and fields you want. And those includes and fields may require scopes asked when creating the token. (Again, this is not applicable if this is the creator access token).

Check out how the WordPress plugin does it:

And this is how it asks the scopes while authorizing: