Authentication
OAuth Flow
The authentication flow differs based on whether you’re using a private or public application.
Private Application Flow (Authorization Code)
-
Redirect Users to Authorization URL
Construct the authorization URL with your
client_id
andcallback_url
: -
Handle the Callback
After authorization, CoLoop redirects to your callback URL with an authorization code:
-
Exchange Code for Tokens
Make a POST request to the token endpoint:
Public Application Flow (PKCE)
-
Generate PKCE Challenge
-
Redirect to Authorization URL with PKCE
-
Exchange Code for Tokens
Using the Access Token
For both flows, use the access token to make authenticated requests:
Token Refresh
When the access token expires (after 2 hours), use the refresh token to get a new one:
Security Considerations
- Token Storage
- Store access tokens and refresh tokens securely
- For public applications, use secure browser storage mechanisms
- For private applications, use server-side secure storage
- PKCE Verifier
- Generate a new code verifier for each authorization request
- Store the verifier securely until the token exchange
- Error Handling
- Handle token expiration and refresh scenarios gracefully
- Implement retry logic with exponential backoff for failed requests
Was this page helpful?