JWT refresh token flow

后端 未结 3 1314
没有蜡笔的小新
没有蜡笔的小新 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:36

    Assuming that this is about OAuth 2.0 since it is about JWTs and refresh tokens...:

    1. just like an access token, in principle a refresh token can be anything including all of the options you describe; a JWT could be used when the Authorization Server wants to be stateless or wants to enforce some sort of "proof-of-possession" semantics on to the client presenting it; note that a refresh token differs from an access token in that it is not presented to a Resource Server but only to the Authorization Server that issued it in the first place, so the self-contained validation optimization for JWTs-as-access-tokens does not hold for refresh tokens

    2. that depends on the security/access of the database; if the database can be accessed by other parties/servers/applications/users, then yes (but your mileage may vary with where and how you store the encryption key...)

    3. an Authorization Server may issue both access tokens and refresh tokens at the same time, depending on the grant that is used by the client to obtain them; the spec contains the details and options on each of the standardized grants

提交回复
热议问题