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

auth.session() and auth.user() return null in SPA app when called right after createClient #130

Closed
gawlk opened this issue Feb 15, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@gawlk
Copy link

gawlk commented Feb 15, 2021

Bug report

Describe the bug

database.auth.session() and database.auth.user() are both null when called right after const database = createClient(SUPABASE_URL, SUPABASE_ANON_KEY) in a SPA app.

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

Just try the code

Expected behavior

I expect database.auth.session() and database.auth.user() to not return null if a user is connected. I need to check that in my router to change the route if needed, yet can't without doing some custom code because of the null issue. The storage being synchronous, the returns shouldn't be null.

System information

  • OS: Mac OS
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: latest
  • Version of Node.js: latest
@gawlk gawlk added the bug Something isn't working label Feb 15, 2021
@kiwicopple
Copy link
Member

Hey @gawlk - I believe you're running into this one: supabase/auth-js#36

I'm working on it this week, just trying to figure out the best way to handle it for expo apps .

If you think it's unrelated feel free to re-open 👍

@silasabbott
Copy link

I'm having this exact same issue trying to redirect to/away from my login page. @gawlk, what did you end up doing?

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