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

Temporary tokens are missing #40

Open
atten opened this issue Aug 14, 2018 · 3 comments
Open

Temporary tokens are missing #40

atten opened this issue Aug 14, 2018 · 3 comments

Comments

@atten
Copy link

atten commented Aug 14, 2018

It seems that tokens are persistent in current realization. That means there is no logout feature. Session invalidation after resetting password is also missing. Do you plan to implement this features?

@nolandg
Copy link

nolandg commented Sep 8, 2018

I have a fork going that uses secure httpOnly cookies to exchange the token. It solves security, SSR, and logout problems.

I think this is the best way to do it for SSR. Using localStorage to store the token and then send in headers can never be done on the first request so logged in users have the wrong page rendered on the server. Other than cookies, the only other way around this is using service workers.

Using cookies also helps mitigate xss attacks since they are httpOnly. I implement CSRF protection by using x-requested-with header and proper CORS setup on the backend.

The logout problem is solved with the dual cookie method. One is secure and one is not and each carry a unique token signed with a different key. The presence of both is required to authenticate. The browser can clear the insecure cookie thus logging out without hitting the server and risk of failure due to connection loss etc. An attacker cannot login through xss because they lack the 2nd signed token. Reloading the page on a public computer for instance will still have the secure cookie but will fail authentication because it lacks the insecure one.

@P4trik
Copy link

P4trik commented Jan 24, 2019

@nolandg
Could you share these parts of implementation with dual cookies?
I'm very interested in this technique.
I've seen some examples with http-only cookies and localStorage in combination.

@nolandg
Copy link

nolandg commented Jan 25, 2019

I'm working on this project again this weekend, will try to post some stuff 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