How to get new SessionToken using Okta Auth JS Session


We are using okta-auth-js GitHub - okta/okta-auth-js: The official js wrapper around Okta's auth API and even though there are methods that use sessionTokens, there is no method to obtain a new sessionToken

Do you know how to get a new sessionToken using Okta-auth-js?

More specifically, we are redirecting from our app to okta’s user credentials form and then redirecting to our app. At that point how could we obtain a sessionToken so that the accessTokens are automatically renewed?

If you’re in an Okta Classic org (not Identity Engine), you can get a sessionToken back when successfully completing primary authentication (username/password + any required factors based on Org level sign on policies) via the /authn endpoint.

To kick off this flow in AuthJS, you can use the signInWithCredentials method.

Apparently our okta instance manager team had the sessionTokens disabled U.U

Now after login-in with redirect flow we get back the refresh token and it can be used to establish a session and renew tokens.


1 Like

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