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

Provider login refreshes page after callback? #109

Closed
xavidram opened this issue Dec 23, 2020 · 9 comments
Closed

Provider login refreshes page after callback? #109

xavidram opened this issue Dec 23, 2020 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@xavidram
Copy link

xavidram commented Dec 23, 2020

Bug report

Describe the bug

When calling the supabase.auth.signIn({ provider }) method, after the provider redirect, the response payload returns to the login page, but a sudden page refresh occurs, causing the response to result in a null state. It does not happen when the grant_type is password, only when trying to use a provider login. The local storage session is properly set.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to https://github.com/Anstroy/alacena-vue-3.git
  2. Clone the repo and install dependencies and add supabase url and key
  3. Start repo using yarn serve
  4. Try logging in using a provider.
  5. Take a look at the console. The console.log within services/supabase login function should output the response, but you will see it outputs the response then suddenly swaps to null, due to what seems like a sudden page refresh.

Expected behavior

Response from callback should return to the callback URL and a page refresh after the site has returned should not occur?

Screenshots

Will work on getting screenshots.

System information

  • OS: Windows
  • Browser (if applies) Brave
  • Version of supabase-js: latest
  • Version of Node.js: 12.18.3
@xavidram xavidram added the bug Something isn't working label Dec 23, 2020
@kiwicopple
Copy link
Member

a sudden page refresh occurs

Hey @ykdojo - are you seeing this behaviour in your Vue app?

@ykdojo ykdojo self-assigned this Dec 23, 2020
@xavidram
Copy link
Author

The reason I want to catch the response from the authorization is to set the reactive state. And the login page has a route guard to prevent authenticated users to access the login page. When the call returns from the 3rd party login page, it returns to the login page, which does not have a user loaded into the reactive state. My work around for now is to check the localstorage for the session and shove it into the state at that point and time if it gets back to the login page.

@ykdojo
Copy link

ykdojo commented Dec 28, 2020

@kiwicopple when I log in using an OAuth provider (GitHub) on our Vue to-do example app, I do see the login page being shown for a split second after the redirect - but I'm not sure if it's the same thing as what @xavidram described here.

@xavidram - I tried reproducing your bug, but it seems like you've made some changes to your codebase since you filed this issue here - could you tell me which commit I can reproduce this bug on?

@xavidram
Copy link
Author

@ykdojo The current commit should produce the same issue. On login, the provider redirects me to the Github page, then redirects me back.

The route guard doesn't seem to protect the route on return from the provider callback. So I need to sit and tinker with it some more. I am going to close this issue. I need to find a workaround for collecting the authenticated payload from the providers, and do some handling on my end.

@seenickcode
Copy link

@xavidram do you remember any solution to this?

@xavidram
Copy link
Author

No. I never got it to work so I just built my own auth server for the project.

@seenickcode
Copy link

Ok thanks.

@th-m
Copy link

th-m commented Aug 29, 2023

I actually just dealt with this today. It was a heck of a pain to debug. Turns out it is mostly harmless to the user, and I am keeping it as a feature for now.

@Pfurr
Copy link

Pfurr commented Oct 10, 2023

some issue (only) with supabase.auth.signInWithOAuth({provider}) ---> i m working with next js and PKCE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants