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

Randomly, TOKEN_REFRESHED and SIGNED_IN events both fire #535

Closed
j4w8n opened this issue Nov 11, 2022 · 5 comments
Closed

Randomly, TOKEN_REFRESHED and SIGNED_IN events both fire #535

j4w8n opened this issue Nov 11, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@j4w8n
Copy link
Contributor

j4w8n commented Nov 11, 2022

Bug report

Low priority. Just documenting.

Describe the bug

Sometimes a SIGNED_IN event is fired along with the TOKEN_REFRESHED event. Both access_token outputs have the same expires_at and token value.

This happens randomly - or seems to. During one test, after initial sign in, it didn't happen until the 5th token refresh. Then the 2nd and 3rd after that. But on a second test, it happened on the 2nd token refresh after initial sign in.

To Reproduce

Currently unsure if this is reproducible. But I have a basic client setup, with no explicit options. In onAuthStateChange, log the event and session. Then login and observe the browser console.

Expected behavior

Only see TOKEN_REFRESHED event when a token is refreshed.

Screenshots

Screen Shot 2022-11-11 at 1 24 29 PM

System information

  • OS: macOS
  • Browser Firefox
  • Version of supabase-js: 2.0.5
  • Version of Node.js: 16.15.0

Additional context

Github OAuth, SvelteKit. No auth helpers.

@j4w8n j4w8n added the bug Something isn't working label Nov 11, 2022
@j4w8n
Copy link
Contributor Author

j4w8n commented Nov 16, 2022

I just had a case where the SIGNED_IN event did the same thing. Although I was doing something else, so I'm not sure if they came in at the same time, or if the 2nd was a few seconds later.

Screen Shot 2022-11-16 at 9 08 50 AM

@hf
Copy link
Contributor

hf commented Dec 30, 2022

Hey I believe this "problem" should be getting addressed with #564.

@j4w8n
Copy link
Contributor Author

j4w8n commented Dec 30, 2022

This may have also been because my laptop was connected to wired and wireless networks at the same time. I haven't gone back and verified whether that might have been the cause.

@hf
Copy link
Contributor

hf commented Dec 31, 2022

This may have also been because my laptop was connected to wired and wireless networks at the same time. I haven't gone back and verified whether that might have been the cause.

I don't think that would have any effect. The browser doesn't really know about how many networks you're connected to.

@kangmingtay
Copy link
Member

i think we can close this one, we only fire either the TOKEN_REFRESHED event in _callRefreshToken() or the SIGNED_IN event: https://github.com/supabase/gotrue-js/blob/7d75c08125cfe7f3904d1b4d68fc868c94510992/src/GoTrueClient.ts#L1064-L1080

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

3 participants