JWT refresh token flow

后端 未结 3 1322
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 00:56

I\'m building a mobile app and am using JWT for authentication.

It seems like the best way to do this is to pair the JWT access token with a refresh token so that I

3条回答
  •  臣服心动
    2020-11-28 01:27

    Based in this implementation with Node.js of JWT with refresh token:

    1) In this case they use a uid and it's not a JWT. When they refresh the token they send the refresh token and the user. If you implement it as a JWT, you don't need to send the user, because it would inside the JWT.

    2) They implement this in a separated document (table). It has sense to me because a user can be logged in in different client applications and it could have a refresh token by app. If the user lose a device with one app installed, the refresh token of that device could be invalidated without affecting the other logged in devices.

    3) In this implementation it response to the log in method with both, access token and refresh token. It seams correct to me.

提交回复
热议问题