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(adapter-nextjs): server-side sign out not working with Firefox and Safari #14246

Merged
merged 5 commits into from
Feb 26, 2025

Conversation

HuiSF
Copy link
Member

@HuiSF HuiSF commented Feb 25, 2025

Description of changes

When Amazon Cognito /logout endpoint redirects back to the /sign-out-callback route the first time, let the handler sends client a 200 response with a intermediate page containing a redirect action to redirect to /sign-out-callback again to ensure the token cookies to be sent to the Next.js server so the sign-out process can complete correctly.

Details see corresponding in-code comments.

Issue #, if available

Description of how you validated changes

  • manual testing with sample Next.js app created with both App and Pages routers
  • unit tests
  • E2E test will be added.

Checklist

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

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

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

Comment on lines +73 to +78
extends AuthApiRequestHandlerInputBase {
request: Request;
handlerInput: CreateAuthRoutesHandlersInput;
}
interface HandleSignOutCallbackRequestForPagesHandlerInput
extends Omit<AuthApiRequestHandlerInputBase, 'origin'> {
extends AuthApiRequestHandlerInputBase {
Copy link
Member

Choose a reason for hiding this comment

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

Would this break anything? Although I don't know if anything can be done about it anyway if origin is needed even if it were

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a internal only function interface.

);

return new Response(
createOnSignInCompleteRedirectIntermediate({
Copy link
Member

Choose a reason for hiding this comment

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

Is it confusing to create a "signInComplete..."? Maybe the function should be renamed to createRedirectionIntermediary or something?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yes, I meant to change the function name, will update.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

@HuiSF HuiSF merged commit b940a23 into main Feb 26, 2025
30 checks passed
@HuiSF HuiSF deleted the hui/fix/adapter-nextjs/server-sign-out branch February 26, 2025 17:13
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.

5 participants