code and the original state token appended as query parameters. You do not call this endpoint directly — you configure it as the redirect URI when registering your OAuth application with Discord or Roblox, and the provider calls it on your behalf.
Endpoint
Path Parameters
string
required
The OAuth provider completing the flow. Must be one of:
discordroblox
Query Parameters
string
required
The opaque state token originally issued by
POST /v1/oauth/:provider. The server validates this value against its cache to confirm the callback belongs to a legitimate, unexpired authorization request.string
required
The short-lived authorization code issued by the provider after the user consents. The server exchanges this code for the user’s access and refresh tokens on your behalf — you never handle the provider tokens directly.
Behavior
When the server receives a valid callback it:- Looks up the
statevalue in its server-side cache to retrieve the originalredirectUrland associated user context. - Exchanges the
codewith the provider (Discord or Roblox) for that provider’s access and refresh tokens. - Fetches the user’s profile from the provider and resolves or creates the corresponding CA Colombia user record.
- Issues a fresh pair of CA Colombia session tokens (or refreshes any existing tokens found in your cookies).
- Sets two
HttpOnlycookies on the response:- Access token — valid for 24 hours.
- Refresh token — valid for 8 days.
- Redirects your browser to the original
redirectUrlwith thestatequery parameter appended so your application can verify the round-trip.
Cookies Set
The cookies are
HttpOnly and scoped to the CA Colombia domain. Your client-side JavaScript cannot read them directly; they are forwarded automatically by the browser on each request when you use credentials: 'include'.
After a Successful Callback
Your browser is redirected to:state parameter on your callback page to confirm the flow completed successfully and then update your application UI accordingly.
Error Handling
Common reasons a callback might fail:- The
statetoken has expired or was never issued (the originalPOST /v1/oauth/:providerwas never called). - The
codeprovided by the provider has already been used or has expired. - You are attempting to link a Roblox account but no CA Colombia user account exists for the session yet (Roblox linking requires an existing account).
- The request originated from an IP address that could not be resolved.
redirectUrl, initiate a fresh OAuth flow by calling POST /v1/oauth/:provider again.
For Roblox OAuth specifically, the user must already have a CA Colombia account (created via a prior Discord login) before linking their Roblox identity. Attempting a Roblox flow without an existing account will result in a redirect to the root.
