I’m very much a newbie when it comes to Okta, so I’m possibly missing something very basic. I’m trying to access the Okta API within a React application.
I’ve started from this sample:
And have got it working as expected. I’ve then modified the Home page to call the Users API by adding the following code within the useEffect:
I’ve confirmed that the okta.users.read.self scope is granted for the application that I’ve created within the Okta admin UI.
The above code results in a 401 error, with the message “The access token is invalid.”
I suspect I’m missing something very basic, but am not sure what it might be. I would greatly appreciate a pointer in the right direction, or hints as to how to debug this.
I wasn’t requesting the okta.users.read.self self scope in the authorize request, but doing so doesn’t change the behaviour that I’m seeing . How would I check “that the token itself contains this scope”?
I believe that I’m using the Org Authorization Server. My org is called “xlio” and I’ve set ISSUER to https://xlio.okta.com/oauth2/default in the testenv file.