nextstrain / nextstrain.org

The Nextstrain website
https://nextstrain.org
GNU Affero General Public License v3.0
87 stars 49 forks source link

authn: Update the refresh token when renewing tokens, if applicable #736

Closed tsibley closed 8 months ago

tsibley commented 8 months ago

Reading the OAuth 2.0 spec again¹, I noted that:

The authorization server MAY issue a new refresh token, in which case the client MUST discard the old refresh token and replace it with the new refresh token. The authorization server MAY revoke the old refresh token after issuing a new refresh token to the client.

I had assumed the refresh token itself was never renewed as I never observed AWS Cognito doing so in practice, but the spec is clear here and we want to support a wider variety of IdPs. Renewable refresh tokens would actually be welcome in Cognito as then we could limit their lifetime to be much closer to the max session age we set. Or perhaps Cognito does renew them, but only as necessary and we've never happened to notice this issue!

¹ https://datatracker.ietf.org/doc/html/rfc6749#section-6

Checklist