Get User Info by access token recieved

I got an access token using Oauth2 method in Okta platform. Now, try to get the user details using API but it’s not working. I add the the access token in request header too. If I do any scope related issue, please let me know how to do request to get the UserInfo

API URL: [https://xxxxxx.okta.com/api/v1/users

Header:
Content-Type:application/json
Authorization:Bearer {{access_token}}

Note: I get the access_token using default authorization server.

Error: error=“insufficient_scope”, error_description=“The access token provided does not contain the required scopes.”, resource=“/api/v1/users”

In order to retrieve the userinfo using the Access Token, the /userinfo endpoint for the specific authorization server would have to be used. That specific endpoint is documented below

If you would like to use the /api/v1/users endpoint instead, this is possible if the token was minted by the Org authorization server. It would just require granting okta.users.read scope within the application settings on Okta and including that scope in the authorization request.

1 Like