Why Does OAuth v2 Have Both Access and Refresh Tokens?

后端 未结 14 2550
情话喂你
情话喂你 2020-11-22 12:36

Section 4.2 of the draft OAuth 2.0 protocol indicates that an authorization server can return both an access_token (which is used to authenticate oneself with a

14条回答
  •  失恋的感觉
    2020-11-22 12:55

    Why not just make the access_token last as long as the refresh_token and not have a refresh_token?

    In addition to great answers other people have provided, there is another reason why we would use refresh tokens and it's to do with claims.

    Each token contains claims which can include anything from the user's name, their roles, or the provider which created the claim. As a token is refreshed, these claims are updated.

    If we refresh the tokens more often, we are obviously putting more strain on our identity services; however, we are getting more accurate and up-to-date claims.

提交回复
热议问题