auth-helpers icon indicating copy to clipboard operation
auth-helpers copied to clipboard

handleAuth is not triggered on session on localhost.

Open pcardosolei opened this issue 2 years ago • 3 comments

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:

  1. Im working on a page
  2. Init session
  3. 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. Screenshot 2022-09-26 at 18 04 43

On production. Screenshot 2022-09-26 at 18 04 49

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.

pcardosolei avatar Sep 26 '22 17:09 pcardosolei

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?

silentworks avatar Sep 26 '22 23:09 silentworks

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

pcardosolei avatar Sep 28 '22 01:09 pcardosolei

@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.

pcardosolei avatar Sep 28 '22 23:09 pcardosolei

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?

francistogram avatar Oct 03 '22 21:10 francistogram

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.

pcardosolei avatar Oct 04 '22 17:10 pcardosolei

Similar issue with standard VITE dev on svelteKit. All done from example, and on localhost its not working.

dawidmachon avatar Oct 12 '22 21:10 dawidmachon

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.

thorwebdev avatar Oct 27 '22 03:10 thorwebdev