OAuth2 with Access + Refresh Tokens
Your API should use the standard OAuth2 Authorization Code flow.1. Authorization request launches the flow
As the first step, Seam makes a GET request to your authorization URL. This should show the user a login screen from your service.Example authorization request
prompt=loginmust force the user to re-authenticate even if they have an existing session.redirect_urishould match one of the URIs Seam registers with your platform.statemust be returned unchanged to prevent CSRF.
2. User login + consent screen
After Seam sends the authorization request in step 1, your service should display a login and consent screen. The user signs in, reviews what Seam will be able to access, and decides whether to continue.
Your UI should:
- ask the user to log in
- clearly show what Seam will access
- allow them to approve or deny
3. Redirect back to Seam with a code
After approval, redirect the browser back to the provided redirect URL:code) and state:
- the redirect URL must exactly match one that Seam registered with your platform.
codeis the temporary value Seam will exchange for tokens.statemust match what Seam originally sent in Step 1.
4. Exchange the code for tokens
Seam will exchange the authorization code for tokens:access_tokenexpires quickly (1his typical)refresh_tokenlasts long and is stableuser_idmust be stable across all future authentications
5. Calling your API with the access token
Seam can call your APIs using the access token. A common way is to do it using the the standardAuthorization header:
6. Refreshing tokens over time
Seam refreshes tokens frequently, sometimes from multiple workflows running at once.POST https://api.provider.com/oauth/tokenContent-Type:
application/x-www-form-urlencoded grant_type=refresh_token&
refresh_token=1//0exampleRefreshToken& client_id=seam_prod_123&
client_secret=shhh_very_secret
Expected response:
Key requirements
- issue a new access token
- keep existing unexpired access tokens valid
- keep the refresh token usable until Seam rotates it
Additional integration requirements
Stable User Identifier
Seam needs a permanent, account-level ID in every OAuth response so it can reconnect accounts and avoid duplicates. This ID must:- remain the same for the lifetime of the account
- not depend on email addresses
- not change when tokens or sessions rotate
Multiple Redirect URLs
Seam generally likes to use separate redirect URIs for production, staging, and local development. It’s preferable if your provider allows registering multiple URLs. Typical examples:Token Stability Requirements
Seam may refresh tokens from multiple workflows at the same time, so refreshing can’t interrupt active requests. Requirements:- issue a new access token during refresh
- let previously issued, unexpired access tokens keep working
- keep the refresh token valid until Seam rotates it
- do not force the user to sign in again or return 401s after refresh

