Why Does OAuth v2 Have Both Access and Refresh Tokens?

后端 未结 14 2591
情话喂你
情话喂你 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:54

    Assume you make the access_token last very long, and don't have refresh_token, so in one day, hacker get this access_token and he can access all protected resources!

    But if you have refresh_token, the access_token's live time is short, so the hacker is hard to hack your access_token because it will be invalid after short period of time. Access_token can only be retrieved back by using not only refresh_token but also by client_id and client_secret, which hacker doesn't have.

提交回复
热议问题