-
Notifications
You must be signed in to change notification settings - Fork 10
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
JWT storage #46
Comments
Yes sure. You should be able to see the JWT in your cookies, this I believe is generated by go-true automatically. The src code never actually uses this cookie directly. We take the parsed payload of the JWT (which the gotrue lib does for you) and persist this into local storage so that we have easy access to the users FaunaDB token which was embeded in the JWT. Depending on who you ask, you should only persist senstive data in the browser for as long as it's required as local storage might be susceptibleto XSS attack. If I was to critically evaluate the security of this app, I would say that persisting the FaunaDB user token in local storage is a potential vulnerability. Take that as you will. If this is a concern it might be better save this token in a cookie instead so that you can benefit from some addtional web security. This would require some refactoring though which I have not really dug into. I've been thinking about doing a Vue 3 version of this demo which can probably address this. |
Thanks much. I wrote up the following in my own notes. I appreciate you wrote up some good summaries in the blog post and in the code itself, all of which was helpful. This is just to pull everything together in my own mind. Anything here that is off track?
1-2 above are handled in |
Yeah, you nailed it. This is summerised much better than I could have written! |
@charlie17 nice write up! |
@chiubaca Curious for your thoughts - what would the argument be against just using Fauna auth across the board, rather than the combo of Fauna + Netlify/GoTrue, as we do here? Any relative tradeoffs? |
The main tradeoff/consideration I can think think of is that you're tightly coupling your auth to Fauna. If you ever wanted to switch databases this could be an issue. This repo explores that pattern if you're interested - https://github.com/ptpaterson/netlify-faunadb-graphql-auth. |
Another question for you Alex (feel free to move/delete from here if more appropriate): Can you say a few words about how the auth JWT tokens are being stored with this approach? localStorage, regular cookie, HttpOnly? Any security matters to be conscious of if using this approach in production?
The text was updated successfully, but these errors were encountered: