You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After setting up my login with credentials (that work perfectly good) i tried to setup the google provider. I followed the documentation but when i click to login, i'm redirected to the google login page, i choose the user that i want, and then i'm redirect to my app but not connected. I see the new user in the database with the status "never" in the row "Last Sign In". When i try again that row update with the current date but in my app i'm not logged in.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Go tologin
Click on google button
redirected to my website but not connected
Expected behavior
I want to be connected after the google redirection.
@NicolasDeGouveia are you calling the handleSignInClick function from the client-side or server-side? the supabase client you created with createClientComponentClient() returns a supabase client that uses PKCE for auth. This means that after the oauth flow is completed with google, supabase auth returns a code in the query param which will be exchange for a pair of access and refresh tokens.
If you open up your browser network inspector when being redirected to http://localhost:3000?code...., you should be able to see requests made to /token?grant_type=pkce and check if they are failing. This is the endpoint that handles the code exchange i mentioned earlier. If no requests are made to that endpoint, can you reach out to us via support (https://app.supabase.com/support/new) and we can investigate further.
@kangmingtay I'm using it in the client-side. I don't know why but now it's seems to work, but now when i'm logged with google i'm well redirected to my homepage but i must press F5 to be able to see the user connected, even if i have a router.refresh() in my function :
@NicolasDeGouveia not too sure what router.refresh() here does but calling it right after signInWithOAuth() won't help because signInWithOAuth() only redirects you to the oauth provider (google) to kickstart the oauth flow. After authenticating with google, you are actually redirected to an endpoint on Supabase Auth first before redirecting again back to the client.
You can try moving router.refresh() to your homepage and see if that helps. Since this issue is resolved, i'm gonna mark it as closed for now.
Activity
j4crev commentedon Aug 2, 2023
Are you using hosted supabase or a local stand-alone?
NicolasDeGouveia commentedon Aug 8, 2023
I'm using a local stand-alone
kangmingtay commentedon Aug 21, 2023
@NicolasDeGouveia can you please include the code you used to initialise the supabase client?
NicolasDeGouveia commentedon Aug 21, 2023
I initialize the supabase client with :
const supabase = createClientComponentClient();kangmingtay commentedon Aug 21, 2023
@NicolasDeGouveia are you calling the
handleSignInClickfunction from the client-side or server-side? the supabase client you created withcreateClientComponentClient()returns a supabase client that uses PKCE for auth. This means that after the oauth flow is completed with google, supabase auth returns a code in the query param which will be exchange for a pair of access and refresh tokens.If you open up your browser network inspector when being redirected to
http://localhost:3000?code...., you should be able to see requests made to/token?grant_type=pkceand check if they are failing. This is the endpoint that handles the code exchange i mentioned earlier. If no requests are made to that endpoint, can you reach out to us via support (https://app.supabase.com/support/new) and we can investigate further.NicolasDeGouveia commentedon Aug 24, 2023
@kangmingtay I'm using it in the client-side. I don't know why but now it's seems to work, but now when i'm logged with google i'm well redirected to my homepage but i must press F5 to be able to see the user connected, even if i have a
router.refresh()in my function :Any ideas of why ?
kangmingtay commentedon Aug 24, 2023
@NicolasDeGouveia not too sure what
router.refresh()here does but calling it right aftersignInWithOAuth()won't help becausesignInWithOAuth()only redirects you to the oauth provider (google) to kickstart the oauth flow. After authenticating with google, you are actually redirected to an endpoint on Supabase Auth first before redirecting again back to the client.You can try moving
router.refresh()to your homepage and see if that helps. Since this issue is resolved, i'm gonna mark it as closed for now.umershabir commentedon Nov 8, 2024
I am literally getting frustrating what is going wrong, const signInWithGoogle = async () => {
try {
const { data, error } = await supabase.auth.signInWithOAuth({
provider: "google",
options: {
redirectTo:
${window.location.origin}/menu/,scopes: "email profile", // Add required scopes
},
});
};
what I am doing wrong here, it follow the oauth flow, then nothin happens
ci: fix sed for releasing `@supabase/gotrue-js` (#823)