samples-js-vue icon indicating copy to clipboard operation
samples-js-vue copied to clipboard

Latest Okta sign in version doesn't redirect after authentication

Open scott-david-walker opened this issue 5 years ago • 3 comments

I used the basic skeleton of the sample project to start my own project and ran into issues with Okta not redirecting after successful authentication. After a chunk of debugging, I realised that I am on the latest version of the Okta Sign In Widget (^5.0.1) whilst the sample project is on ^4.4.4. If I downgrade to 4.4.4 then the redirect works as expected.

To confirm, I upgraded the sample project to "@okta/okta-signin-widget": "^5.0.1", and can confirm that the redirect no longer works after successful authentication.

Is there another package I need to install for it to work on this version or am I missing something simple?

scott-david-walker avatar Nov 16 '20 22:11 scott-david-walker

@scott-david-walker - hello again! You are correct - the samples are currently using version 4.x of the okta-signin-widget.

otka-signin-widget 5.x is a recent release and we are still updating our various samples and guides to reflect the changes.

In the meantime, if you are interested in using the latest okta-signin-widget, you can apply the steps listed in our migration guide: https://github.com/okta/okta-signin-widget/blob/master/MIGRATING.md#migrating-from-4x-to-5x, in particular the first two items apply to what you are describing:

swiftone avatar Nov 16 '20 22:11 swiftone

How to store tokens in showSignInToGetTokens, so okta auth can see them?

cysieks avatar Nov 19 '20 14:11 cysieks

@cysieks - We have not yet updated this sample to use the 5.x version of the okta-signin-widget to show that flow, but until we do hopefully this gives you enough information:

  • Step 1: Get a reference to the tokenManager: https://github.com/okta/okta-vue#authgettokenmanager
  • Step 2: Add the tokens to the tokenManager: https://github.com/okta/okta-auth-js#tokenmanager-1

the calls would be similar to:

        tokenManager.add('idToken', tokens.idToken);
        tokenManager.add('accessToken', tokens.accessToken);

swiftone avatar Nov 19 '20 19:11 swiftone