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(sveltekit): broken redirect to another origin when callbackUrl contains a # #10121

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

dievardump
Copy link

When a callbackUrl contains a #, signIn and signOut are automatically reloading the page, to ensure thre is a reload.

However, if the redirect is supposed to redirect to another origin, window.location.reload() should not be performed, else it bypasses the window.location.href

This PR adds a check if the callbackUrl and the current url have the same origin, before allowing or not a location.reload()

Copy link

vercel bot commented Feb 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ❌ Failed (Inspect) May 19, 2024 3:44pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview May 19, 2024 3:44pm

Copy link

vercel bot commented Feb 23, 2024

@dievardump is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

@dievardump dievardump changed the title Fix broken redirect to another origin when URL contains a # Fix: sveltekit broken redirect to another origin when URL contains a # Feb 23, 2024
@dievardump dievardump changed the title Fix: sveltekit broken redirect to another origin when URL contains a # Fix: sveltekit broken redirect to another origin when callbackUrl contains a # Feb 23, 2024
@ndom91 ndom91 changed the title Fix: sveltekit broken redirect to another origin when callbackUrl contains a # fix(sveltekit): broken redirect to another origin when callbackUrl contains a # May 19, 2024
Copy link

codecov bot commented May 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes are missing coverage. Please review.

Please upload report for BASE (main@4fc8fe8). Learn more about missing BASE report.

Current head b6eb830 differs from pull request most recent head 3212cca

Please upload reports for the commit 3212cca to get more accurate results.

Files Patch % Lines
packages/frameworks-sveltekit/src/lib/client.ts 0.00% 10 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10121   +/-   ##
=======================================
  Coverage        ?   38.73%           
=======================================
  Files           ?      176           
  Lines           ?    27892           
  Branches        ?     1223           
=======================================
  Hits            ?    10804           
  Misses          ?    17088           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ndom91
Copy link
Member

ndom91 commented May 19, 2024

I'm having trouble reproducing this, can you provide an minimal repro? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants