Okta-signin-widget and storageKey

Hi @andrea @abole

I am using okta-signin-widget with PKCE flow like below -

import OktaSignIn from '@okta/okta-signin-widget'
var signIn = new OktaSignIn(
    issuer: 'https://{yourOktaDomain}/oauth2/default',
    clientId: '{{clientId of your OIDC app}}',
    redirectUri: '{{redirectUri configured in OIDC app}}',

I want to change the okta-token-storage key. By default all tokens will be stored under the key okta-token-storage.

But in may case, I have multiple apps so I want to keep it in unique storage key for each app.

I have gone through documentation GitHub - okta/okta-auth-js: The official js wrapper around Okta's auth API. In this storageKey config is mentioned, but I don’t know how to use it or how to pass it as a config.

Can anyone help me on this?


Put it inside the authParams or authClient, that’s how you configure the AuthJS features/functionality within the widget config: GitHub - okta/okta-signin-widget: Okta SignIn widget that renders the new login/auth/recovery flows. E.g:

authParams: {
    tokenManager: {
        storageKey: 'custom-storage-name'

I have tried with authParams, its not working.
Using below versions of okta lib-

    "@okta/okta-auth-js": "^6.5.0",
    "@okta/okta-react": "^6.4.3",
    "@okta/okta-signin-widget": "^6.3.0",

Could you share your implementation @tparikh ? We may be able to spot something. How do you know its not working? Do you see an error?

After authn, we are not able to see custom storagekey name in browser cookie instead token is stored in default name (Okta default key name)

Do you need to specify storage: 'cookie' as well to make it work? Default is session storage I think.