Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssr-adapter): refreshToken may return the same tokens across requests #13387

Merged
merged 1 commit into from
May 15, 2024

Conversation

HuiSF
Copy link
Member

@HuiSF HuiSF commented May 15, 2024

Description of changes

  1. Exported a non-deduped token refresher function
  2. Updated the SSR adapter to use the non-deduped token refresher function to create context
  3. Fixed that in a getServerSideProps context, refresh tokens were not being sent back to client cookie store

Issue #, if available

Description of how you validated changes

  1. unit tests
  2. manual testing with Next.js sample apps

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@HuiSF HuiSF force-pushed the hui/fix/patch-ssr-regression branch from 1283b78 to 4ce42e7 Compare May 15, 2024 22:35
@@ -77,3 +77,4 @@ const refreshAuthTokensFunction: TokenRefresher = async ({
};

export const refreshAuthTokens = deDupeAsyncFunction(refreshAuthTokensFunction);
export const refreshAuthTokensWithoutDedupe = refreshAuthTokensFunction;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Just rename refreshAuthTokensFunction -> refreshAuthTokensWithoutDedupe and export it

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do this later, as I'm thinking of a different solution to create dedupe edition for SSR use cases.

Copy link
Contributor

@jimblanc jimblanc left a comment

Choose a reason for hiding this comment

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

Change looks good, need to target release with your PR though.

@HuiSF HuiSF changed the base branch from main to release May 15, 2024 22:52
@HuiSF HuiSF marked this pull request as ready for review May 15, 2024 22:54
@HuiSF HuiSF requested a review from a team as a code owner May 15, 2024 22:54
@HuiSF HuiSF force-pushed the hui/fix/patch-ssr-regression branch from 4ce42e7 to 432638d Compare May 15, 2024 23:00
@HuiSF HuiSF merged commit 2e5e2f1 into release May 15, 2024
28 checks passed
@HuiSF HuiSF deleted the hui/fix/patch-ssr-regression branch May 15, 2024 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants