<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D51Y00007Ul97dSABOkta Classic EngineSingle Sign-OnAnswered2024-04-15T09:30:27.000Z2020-01-06T20:02:20.000Z2020-09-02T02:18:14.000Z

DavenC.15920 (Customer) asked a question.

invalid_token Error when requesting UserInfo

When I call the /oauth2/v1/userinfo endpoint I am receiving an invalid_token response.

 

I have created an application as described here

https://developer.okta.com/docs/guides/implement-auth-code/setup-app/

 

I have exchanged the code for a token as described here

https://developer.okta.com/docs/guides/implement-auth-code/exchange-code-token/

 

When I make a call for user info as described here I recieve an invalid token response

https://developer.okta.com/docs/reference/api/oidc/*userinfo

 

Additional Info

 

Error

WWW-Authenticate: Bearer authorization_uri="http://dev-xxx.okta.com/oauth2/v1/authorize", realm="http://dev-xxx.okta.com", scope="openid", error="invalid_token", error_description="The access token is invalid.", resource="/oauth2/v1/userinfo"

 

Access Code URL

https://dev-xxx.okta.com/oauth2/default/v1/authorize?response_type=code&state=xx&nonce=xx&response_type=code&client_id=[clienId]&redirect_uri=[URL]&scope=openid%20profile%20email

 

Token Request

curl --request POST \

 --url https://dev-xxx.okta.com/oauth2/default/v1/token \

 --header 'accept: application/json' \

 --header 'authorization: Basic {AuthToken}' \

 --header 'content-type: application/x-www-form-urlencoded' \

 --data 'grant_type=authorization_code&redirect_uri=[URL]&code=[code]'

 

UserInfo Request

curl -v -X POST \

-H "Authorization: Bearer {accessToken}" \

"https://dev-xxx.okta.com/oauth2/v1/userinfo"

 

User Setup

I have created and am testing with one user who is assigned to the everyone group


  • GregP.65760 (Customer)

    Did you ever figure this out? I have the same problem, curl works, but multiple other clients do not. The system log says far less than the actual error code.

This question is closed.
Loading
invalid_token Error when requesting UserInfo
Okta Support Agent (Beta)

Terms of Service

Hello! I'm the Okta Support Agent (Beta), your go-to resource for questions about Okta products. Please remember for your security and privacy, do not share any Personally Identifiable Information (PII) such as passwords, IP addresses, or other details with me.

Okta Privacy Policy and Terms of Service apply