Hello,
Using GitHub - okta/okta-auth-js: The official js wrapper around Okta's auth API library version 7.3.0 and I can’t retrieve tokens.
I use the authorization code flow for web client. GitHub - okta/okta-auth-js: The official js wrapper around Okta's auth API
My config is something like that:
{
issuer: ‘my issuer’,
clientId: ‘my client id’,
clientSecret: ‘my client secret’,
redirectUri: window.location.origin + ‘/oidc-callback’,
scopes: [‘openid’, ‘email’],
state: ‘state1’,
// Use authorization_code flow
responseType: ‘code’,
responseMode: ‘query’,
pkce: false
}
For redirect part I use a path routing GitHub - okta/okta-auth-js: The official js wrapper around Okta's auth API
So I do these different steps :
- Define a redirectUri that maps to a dedicated route in your app
- Before redirect, save the current route: setOriginalUri
- Do the redirect to okta: token.getWithRedirect
- After successful authentication, Okta will redirect back to the configured redirectUri, your app should load on the dedicated callback route
- On this callback page:
- call token.parseFromUrl to retrieve tokens
- Add tokens to the TokenManager: tokenManager.setTokens
- Read saved route and redirect to it: getOriginalUri
When I call token.parseFromUrl GitHub - okta/okta-auth-js: The official js wrapper around Okta's auth API I’m waiting a call to /token url like explain in the documentation “If an authorization code is present, it will be exchanged for token(s) by posting to the tokenUrl endpoint.”, but nothing happens.
It return just {} for tokens.
In the schema of authorization code flow of Implement authorization by grant type | Okta Developer I’m waiting the step 5 to be done by the library.
The callback is correctly called with the authorization code : /oidc-callback?code=37wzhFrMHAiKBXpxQBOwBtlCLVZnSCGzxfEbzfKqgJg&state=state1
Maybe I’m doing something wrong, not giving the correct options or not calling the right function.
Can you explain me where am I doing wrong please ?