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

Supabase auth always overwrites the window location during restoreAuth #9549

Open
KrisCoulson opened this issue Nov 19, 2023 · 3 comments
Open
Assignees

Comments

@KrisCoulson
Copy link
Contributor

KrisCoulson commented Nov 19, 2023

This line below always overwrites the window location any time a redwood app loads. It is meant to handle refreshing the auth tokens. The issue is this completely wipes out search params on page load even if they are unrelated to supabase authentication.

window.history.replaceState(
{},
document.title,
window.location.pathname
)

It always gets called because this useEffect calls restoreAuth.

// Whenever the authImplementation is ready to go, restore auth and reauthenticate
useEffect(() => {
async function doRestoreState() {
await authImplementation.restoreAuthState?.()
reauthenticate()
}
doRestoreState()
}, [reauthenticate])

@Tobbe
Copy link
Member

Tobbe commented Nov 20, 2023

Thanks @KrisCoulson. Do you want to take a look at fixing it? No pressure, just let me know 🙂

@KrisCoulson KrisCoulson self-assigned this Nov 21, 2023
@KrisCoulson
Copy link
Contributor Author

Yeah @Tobbe I can take a look at this. I self assigned. Not 100% sure when I can get to it ATM but I just wanted to get it documented here.

@Tobbe
Copy link
Member

Tobbe commented Nov 22, 2023

Yeah, no rush, and thank you! 🙏

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

No branches or pull requests

2 participants