Skip to content

The user is undefined after a page refresh. #1

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

Closed
michalczaplinski opened this issue Mar 8, 2019 · 6 comments
Closed

The user is undefined after a page refresh. #1

michalczaplinski opened this issue Mar 8, 2019 · 6 comments

Comments

@michalczaplinski
Copy link

michalczaplinski commented Mar 8, 2019

A page refresh logs a user out. This behaviour can be seen in the example linked in the README.

To reproduce:

Go to https://netlify-gotrue-in-react.netlify.com/

I can log in by providing by the url to my identity service: https://dropclub.netlify.com

After logging in I'm redirected to /dashboard. Then, when I refresh the page I am redirected back to the login page and I can see that user is undefined in the console.

I was under the impression that gotrue-js should be storing the user information in localStorage for me. Is this functionality outside of the scope of this package or would you expect it to work?

@michalczaplinski michalczaplinski changed the title the user is undefined after a page refresh The user is undefined after a page refresh. Mar 8, 2019
@swyxio
Copy link
Contributor

swyxio commented Mar 15, 2019

indeed i expect gotrue-js would store it in localstorage. i am wondering if theres some CORS issue here.

EDIT: it seems to be a known issue - netlify/gotrue-js#35

we may just need to setCookie:true

@swyxio
Copy link
Contributor

swyxio commented Mar 15, 2019

fixed in https://github.com/sw-yx/react-netlify-identity/releases/tag/0.0.7 i think - please lmk if it doesnt

@swyxio swyxio closed this as completed Mar 15, 2019
@b-reklass
Copy link

Hey @sw-yx this is fixed on production but doesn't appear to be fixed when testing @ localhost. Would be nice to have this for testing.

@swyxio
Copy link
Contributor

swyxio commented Apr 8, 2019

hey @michalczaplinski and @b-reklass turns out it might be my fault - see this PR #2

@michalczaplinski
Copy link
Author

@sw-yx Sorry, I went with another solution for auth in the meantime, but I ll definitely use this on another project and let you know how it works. Thanks for the great work ! :)

@swyxio
Copy link
Contributor

swyxio commented Apr 30, 2019

no problem. i made this when i was just learning, but i use this project more intensively now so ive ironed out a few more flaws sicne then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants