Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
getUser
returns null if there is no session (#876)
If there is no session (i.e. no JWT/access token), `getUser()` cannot possibly work. It now returns null user. Previously, it just sent out a request _without the JWT_. When combined with `@supabase/supabase-js` which does some clever tricks with `fetch` by adding a default `Authorization` header using the Supabase `anon` API key, if you called `getUser()` at the wrong time an error such as `missing sub claim` error message would be thrown by Supabase Auth. (Unfortunately the Supabase `anon` API key is signed with the same JWT secret, so it's hard to disambiguate why this is happening.)
- Loading branch information