Unable to get user info from OKTA with access token

2.3k Views Asked by At

I have valid access token from OKTA when i call user info end point for user details i am getting 401 Unauthorised for the below POST request

https://*******.okta.com/oauth2/epros/v1/userinfo
Authorization : Bearer **

I have claims defined at OKTA for accesstoken as well Any clue why for valid access token, i am getting 401?

1

There are 1 best solutions below

0
On

Assuming you have checked your token is still valid, not expired revoked etc. Your userinfo endpoint looks a little odd, where you have epros you would normally have the id of the authorization server.

For example https://*****.okta.com/oauth2/ausaew0e1C0brPuB80x6/v1/userinfo

You may have truncated that address as if that value is wrong you would get 400 bad request.

The correct endpoint will always be the value in the iss claim in the token plus /v1/userinfo, if you are sending the access token of one to another authorization server's userinfo you will get a 401 response.