I am using Single Sign On with openID, I integrate the okta with my application, everything is done.
Now I need to authorize the user,
I am getting the access token with the end point of :
https://{url}/oauth2/default/v1/authorize?
with this url its provide me the code which I convert the code to the access token and successfully done it.
NOW I need the user info with this token so I am using the url : {{url}}/oauth2/v1/userinfo
after I add my bearer access token in authorization to make request it gives me 401 error.
You seem to be mismatching the authorization server that issued the token, the “Default” Custom Authorization Server, with the one that you are sending the token to to get Userinfo data, as the URL you are using is for the separate Org Authorization Server. More details about the different server types found here.
Can you try sending the token instead to {{url}}/oauth2/default/v1/userinfo?
If you only see the “sub” claim returned from the /userinfo call, you likely only requested the “openid” scope when the token was requested.
If you are looking to get details about the user from the call, you will want to also request the “profile” scope, and potentially other base scopes for additional information. More details about the scope-dependent claims found here