Skip to content

Commit bd4e86a

Browse files
rickyromboclaude
andauthored
Add refresh_expires_in to OAuth token responses (#756)
## Summary - Adds `refresh_expires_in` field (30 days in seconds) to both the authorization code exchange and refresh token grant responses - Companion to AudiusProject/apps#14078 which adds client-side token expiry tracking to the SDK ## Test plan - [ ] `POST /v1/oauth/token` (authorization_code grant) response includes `refresh_expires_in: 2592000` - [ ] `POST /v1/oauth/token` (refresh_token grant) response includes `refresh_expires_in: 2592000` - [ ] Existing `expires_in` field unchanged (still 3600) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ef57d29 commit bd4e86a

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

api/v1_oauth.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,12 @@ func (app *ApiServer) oauthTokenAuthorizationCode(c *fiber.Ctx, body *oauthToken
365365
}
366366

367367
return c.JSON(fiber.Map{
368-
"access_token": accessToken,
369-
"token_type": "Bearer",
370-
"expires_in": 3600,
371-
"refresh_token": refreshToken,
372-
"scope": storedScope,
368+
"access_token": accessToken,
369+
"token_type": "Bearer",
370+
"expires_in": 3600,
371+
"refresh_token": refreshToken,
372+
"refresh_expires_in": int(30 * 24 * time.Hour / time.Second),
373+
"scope": storedScope,
373374
})
374375
}
375376

@@ -487,11 +488,12 @@ func (app *ApiServer) oauthTokenRefreshToken(c *fiber.Ctx, body *oauthTokenBody)
487488
}
488489

489490
return c.JSON(fiber.Map{
490-
"access_token": accessToken,
491-
"token_type": "Bearer",
492-
"expires_in": 3600,
493-
"refresh_token": refreshToken,
494-
"scope": storedScope,
491+
"access_token": accessToken,
492+
"token_type": "Bearer",
493+
"expires_in": 3600,
494+
"refresh_token": refreshToken,
495+
"refresh_expires_in": int(30 * 24 * time.Hour / time.Second),
496+
"scope": storedScope,
495497
})
496498
}
497499

0 commit comments

Comments
 (0)