Problem Statement
What is a solid baseline for API authentication?
Explanation
Short lived access tokens reduce blast radius. Refresh tokens allow smooth re auth. Rotation means every refresh returns a new token and invalidates the old one. This limits reuse if a token is stolen. Always use HTTPS so tokens are not exposed in transit.
Also add device binding or sender constraint if possible, and store tokens securely on the client.
Code Solution
SolutionRead Only
POST /oauth/token { grant_type: refresh_token, refresh_token: <old> }
// Server returns new access token and new refresh token