How can we get user details with client id and secret and custom api server

How can we get user details with client id and secret and custom api servers

I have a custom API server and a custom scope that i need to be fetched from the token.
I also need to get the details of the user using the token i get from this api server.
I tried using the {{url}}/oauth2/{{authorizationServerId}}/v1/userinfo but for some reason it gives me 401 error-code

The scopes i get in the token are
“scp”: [
“Custom_Admin”
],

I am using authorization code flow to fetch the token

Please let me know how can i get the user details.

Are you not requesting the openid scope? If you do request it and then send the resulting access token to the userinfo endpoint, does it work then?

after passing the openid in the scopes the api worked but the response was just
{
“sub”: “00u2dn8vdapZ2x7Ol5d7”
}

is there some api i can use to get the entire user details like the name, lastname, email, etc?

Yup, you’ll need to also request the email and profile scopes. More info about the claims associated with the base/default scopes listed here: OpenID Connect & OAuth 2.0 API | Okta Developer

thanks @andrea that helped

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.