auth-helpers
auth-helpers copied to clipboard
handleAuth is not triggered on session on localhost.
Bug report
Describe the bug
(happens in the localhost). After making a login with any service. supabase auth helpers are unable to get a user or an access token , no idea why.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Im working on a page
- Init session
- choose any of the provider options.
3.(.5) it will work. but on localhost it does not.
If required i can send the code.
Expected behavior
It logins in any case as the page after receiving the access token and information.
Screenshots
Just adding here the cookies because I find it strange that "production vercel" only gets 1 cookie set and localhost get 4 and fails to add the provider-token. take a look.
On development.
On production.
System information
- OS: macOS
- Browser (if applies) chrome
- Version of supabase-js: 1.35.7
- Version of Node.js: v16.14.0
Additional context
I was working with previous configuration of packages. Updated the packages and suddenly it stopped working (maybe be not there reason). I did some debugging and it saves the cookies well it seems that we does not reach the supabase.auth.oauthchanged properly.
feel free to send me a message.
Please produce a minimum reproducible example. The steps above is on your own environment and there is no way for anyone else to test this and debug it. Also can you state which auth helper package the issue is with and what version too please?
Hey @silentworks . I'm using :
- auth helper react 0.2.4
- auth helper nextjs 0.2.8
working scenario:
- https://recordit.co/KdkeJWFfNh
localhost failing:
- https://recordit.co/NkJFlCEiLx
I can share the repo with you if you need.
On supabase I have both redirect url allowed.
Cheers
@silentworks I put public the repo for the time being so you can take a look if needed
https://github.com/pcardosolei/feathers
main file is MainProvider and userService to be honest. rest is pretty much all from using auth-helpers.
This has been happening to me too
The interesting thing is that while
import { useUser } from "@supabase/auth-helpers-react";
const { user } = useUser();
returns null
if I do
const authUser = supabaseClient.auth.user();
The user is set correctly
Any updates on this issue?
I'm pushing my project to use Supabase CLI.
oauth provider do not work there but at least I can work a bit with the normal registration. I will create updating the package and close if I reach success.
Cheers.
Similar issue with standard VITE dev on svelteKit. All done from example, and on localhost its not working.
Can you try upgrading to the latest versions and see if that fixes it? Will close this out but please reopen if you're still experiencing this with the latest versions. Thanks.