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

Fix bug for auth on page refresh #152

Open
godwinpang opened this issue Sep 6, 2020 · 1 comment
Open

Fix bug for auth on page refresh #152

godwinpang opened this issue Sep 6, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@godwinpang
Copy link
Collaborator

Config token needs to be set on auth changed (in auth listener) otherwise when we refresh the page we won't have the token.

https://github.com/HKN-UCSD/hkn-member-portal/blob/5a21c9c33dd1da7c9d1069b5ba61d17c1f9c71c3/src/pages/App/index.js#L46

@godwinpang godwinpang added the bug Something isn't working label Sep 6, 2020
@godwinpang godwinpang self-assigned this Sep 9, 2020
@thai-truong
Copy link
Collaborator

Btw for this one, probably shouldn't set config token in setClaims() and only set token in onAuthStateChanged(). onAuthStateChanged() runs first, so if userToken state is not set before the set config token call in setClaims(), then userToken is null, meaning the set config token call in setClaims() will set token to empty string, which stops users from signing in when they click on the sign in button for the first time. After that, they sign in normally.

This is just what I encountered doing some testing with querying for roles using backend api : )

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

2 participants