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

[Auth] Refresh token #8

Closed
Hagith opened this issue Feb 8, 2020 · 3 comments · Fixed by #32
Closed

[Auth] Refresh token #8

Hagith opened this issue Feb 8, 2020 · 3 comments · Fixed by #32
Assignees
Labels

Comments

@Hagith
Copy link
Member

Hagith commented Feb 8, 2020

  • validate token expiration
  • issue refresh token
  • refresh access token

https://medium.com/@sadnub/simple-and-secure-api-authentication-for-spas-e46bcea592ad

@Hagith Hagith self-assigned this Feb 14, 2020
@Hagith
Copy link
Member Author

Hagith commented Feb 14, 2020

nestjs/jwt#122

@ishpagin
Copy link

It would be great to get it from the box, because no tutorials about this topic in nestjs community :(

@Hagith
Copy link
Member Author

Hagith commented Feb 24, 2020

@ishpartko thanks for stopping by. In my opinion refresh token logic is out of scope of passport library, and consequently outside the scope of nestjs/jwt. JWT library only provides mechanism for issuing tokens and it's validation with the secret.
It is the consumer's (project) responsibility to store/manage refresh tokens and implement additional verification logic. This logic mostly depends on the project requirements and can be implemented on may different ways.
My first implementation will be very simple: generate token with extended expiration period, store it in the database and pass it to the client. But I know that it is considered a bad practice form the security point of view.
In the next step I will implement simple "middleware" which will store refresh token in the session and only encrypted Http-Only cookie will be passed to the client.

Hagith added a commit that referenced this issue Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants