Giter Site home page Giter Site logo

jwt-authentication's People

Contributors

webdevsimplified avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jwt-authentication's Issues

Should refresh token have expiration time ?

Hey Kyle, I have followed your tutorial on YouTube and also implemented some logic like you using JWT but in Java with the Framework Spring-Boot.
I am working on a mobile app like Twitter and I would like to know if refresh-tokens should have an expiration time or are there valid forever ?

Question

Hey Kyle.

I've came across your tutorial whilst researching for JWT Authentication.
Quite useful. I'm implementing a prototype myself for a project and I'm a bit confused still.

Lets assume I have a website (example.com) which handles my front-end code. It is a React application that relies on another website for an API (lets say some-api.com)

I've managed to:

  • Create a GraphQL Database of Users and Tokens (not in your tutorial)
  • I've created the /register route and the /login route, both working fine, and withe the later returning the accessToken and the refreshToken
  • I've also implemented the /token route to remove the old token from GraphQL list of valid tokens, and I have it generating a new accessToken and refreshToken similar to what I done in the /login

I Guess my questions are two.

  1. When should I use the accessToken vs the refreshToken
  2. How can I validate a "secure" react router "route" somewhere on my website (example.com)
    Do I need to create a new method that checks if the current accessToken is valid? or should I be checking against the refreshToken? That's what's making it confusing for me.

accessToken's are meant to expire quickly right? So should I be using the accessToken to every api request I need (like /user-profile or whatever) or should I pass the refreshToken?

Thanks for the insight.
Kind regards
Andre

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.