feat: Support OAuth2 single-use refresh tokens (#38364)

This commit is contained in:
Vitor Avila
2026-03-03 16:07:15 -03:00
committed by GitHub
parent 2ab9d37a00
commit fa34609952
4 changed files with 157 additions and 0 deletions

View File

@@ -167,6 +167,10 @@ def refresh_oauth2_token(
token.access_token_expiration = datetime.now() + timedelta(
seconds=token_response["expires_in"]
)
# Support single-use refresh tokens
if new_refresh_token := token_response.get("refresh_token"):
token.refresh_token = new_refresh_token
db.session.add(token)
return token.access_token