-
Notifications
You must be signed in to change notification settings - Fork 128
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
redirectTo does not work for sign in #188
Comments
Hey, +1 here. I was going through supabase docs today for a new project and the AuthUI seemed like the suggested way to handle Auth. Found the same issue in code as OP found in the EmailView. RedirectTo isn't used. Fix should be just providing options hash to signup call |
Oh shoot, that's why my redirects are not working...I spent two hours trying to figure this out haha! |
It seems this is by design supabase/auth-js#217 (comment) And unlikely to be fixed due to tehcnical limitations in the base auth lib |
I have this issue as well |
same |
1 similar comment
same |
I'm really confused by this - it's in the official docs that this should work, no? https://supabase.com/docs/guides/getting-started/tutorials/with-nextjs
|
Hey - it shows the |
This is not an issue, these components aren't smart components and |
Solved this by having the auth-ui component (login / sign up) as a modal in the current view instead of being a separate page. That way if you sign in the UI state will update on sign in without the need for redirection, and for sign up the redirectTo behaviour already works. |
It sounds like it's by design, however if you want it to work you can figure it out in the LoginPage.
|
This helped alot thank you mate i was looking into this way to long. |
Thanks for this awesome solution!
|
For SvelteKit this solution pretty much worked for me import { onMount } from 'svelte';
onMount(() => {
const {
data: { subscription }
} = data.supabase.auth.onAuthStateChange((event) => {
if (event === 'SIGNED_IN') {
goto('/logging-in?redirect=' + '/main', { invalidateAll: true });
}
});
return () => subscription.unsubscribe();
}); Below that is the Auth component |
Workaround:
|
Edit: Never mind, I realized the underlying issue was that I hadn't added the correct URLs in Supabase's allow list. Does the modal solution work for google sign in as well? I've implemented a modal wrapper for AuthUI but user keeps getting redirected to root URL after authenticating |
Bug report
Describe the bug
redirectTo
param on the Auth component is ignored in email sign inTo Reproduce
See related code in https://github.com/supabase/auth-ui/blob/main/packages/svelte/src/lib/Auth/interfaces/EmailAuth.svelte#L41-L47 (where sign up is using redirectTo but not sign in)
Expected behavior
redirectTo
prop value to be honouredScreenshots
N/A
System information
N/A
Additional context
We should be able to provide a better ux for users if we're able to redirect them to where they were before when they sign in, just like we do for sign up
The text was updated successfully, but these errors were encountered: