Getting an "The authorization server id is invalid" on a request to userinfo URL

Hello!

I’m trying to obtain additional claims for a users (e.g given_name) by invoking the userinfo API, shown below:

https://dev-60265957.okta.com/oauth2/v1/userinfo

However, when I try this via curl, it returns this error message:

“The authorization server id is invalid”

As far as I can tell, the bearer token is valid. Here is a screenshot of the bearer token:

I’m using curl from a windows batch file to test (since Spring Boot doesn’t show the detail of the errors).

Here are the contents of the batch file:

@echo off
REM Define variables
set ACCESS_TOKEN=eyJra…
set URL=https://dev-60265957.okta.com/oauth2/v1/userinfo
set OUTPUT_FILE=response.txt

REM Call the user info endpoint using curl, output to file
curl -X GET ^
-H “Authorization: Bearer %ACCESS_TOKEN%” ^
-H “Content-Type: application/json” ^
%URL% ^
–verbose > %OUTPUT_FILE%

REM Output the response to the console
if exist %OUTPUT_FILE% (
echo Response from server:
type %OUTPUT_FILE%
) else (
echo No response file was created.
)

REM Check if the request was successful
if %errorlevel% equ 0 (
echo Request successful. Response written to %OUTPUT_FILE%.
) else (
echo Request failed. Please check the access token or endpoint URL.
)

REM Prevent the window from closing immediately
pause

Here is the output:

Any idea what I’m doing wrong?

Try updating your request URL to https://dev-60265957.okta.com/oauth2/default/v1/userinfo

That way its pointing to the same auth server that issued the token originally, which in this case, is the Default Authorization Server, which you can see in the iss claim in your token payload.

1 Like

Thank you Andrea - you’ve helped me out so much with my questions. You are the best.

Have a happy and prosperous New Year!

1 Like

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