Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

fix[react]: store secureRouterReferrerPath in sessionStorage #884

Merged

Conversation

shuowu
Copy link
Contributor

@shuowu shuowu commented Aug 31, 2020

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Adding Tests
  • Build related changes
  • CI related changes
  • Documentation changes
  • Other... Please describe:

What is the current behavior?

Issue Number: OKTA-282373

What is the new behavior?

Store secureRouterReferrerPath in sessionStorage

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Reviewers

@@ -252,13 +252,13 @@ class AuthService {
if (fromUri.charAt(0) === '/') {
fromUri = window.location.origin + fromUri;
}
localStorage.setItem( 'secureRouterReferrerPath', fromUri );
sessionStorage.setItem( 'secureRouterReferrerPath', fromUri );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the kind of issue that blew us up when we had conflicting versions of Auth JS between the SIW and outside the SIW.

@aarongranick-okta - as I recall, the solution was to first check for the localStorage version, then fall back to the sessionStorage, but that won't work for this scenario (which is specifically multiple tabs), right? Am I overthinking this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, but I saw okta-angular is implemented with sessionStorage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swiftone I don't think this will affect the widget. Unlike the PKCE meta which is stored by auth flow initializer (SIW) and read by callback handler (SDK). This value is stored by the SDK before the redirect to SIW, and read by the SDK after the callback has been handled.

@shuowu-okta shuowu-okta merged commit 1244b68 into master Aug 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants