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

UserContext setSession resets valid provider_token #33

Open
plondon opened this issue Sep 27, 2022 · 1 comment
Open

UserContext setSession resets valid provider_token #33

plondon opened this issue Sep 27, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@plondon
Copy link

plondon commented Sep 27, 2022

Bug report

Describe the bug

When onAuthStateChange is called from the UserContext provider for the TOKEN_REFRESHED event the new session does not contain a provider_token. This means the user can no longer interact with the provider api, even though the old provider_token is still valid.

To Reproduce

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

The

  1. Go to https://app.supabase.com/project/<project_id>/auth/settings
  2. Enable github provider
  3. Set JWT expiry limit to 20 seconds
  4. Login via github on the client
  5. Wait 20 seconds, see that the new session has removed the provider_token

Expected behavior

I'm not sure what the correct behavior should be here, but the provider_token should not be lost without being refreshed. If the provider_token is still valid there is no reason to remove it from the session.

Additional context

The issue stems from setting the session without the old provider_token here: https://github.com/supabase-community/auth-ui/blob/main/packages/react/src/components/Auth/UserContext.tsx#L30

@plondon plondon added the bug Something isn't working label Sep 27, 2022
@plondon
Copy link
Author

plondon commented Sep 27, 2022

Similar discussion: supabase/auth-js#131

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

1 participant