How the flow works
Three actors are involved:- Your app — the application you’re building that needs access to the Flextell API.
- The end user — the person who owns the Flextell account your app wants to act on behalf of.
- Flextell’s authorization server — handles authentication and issues tokens.
Redirect the user to Flextell
Send the user to Flextell’s authorization endpoint. Construct the URL with the required query parameters:
Must be
code. Tells Flextell you are using the Authorization Code flow.Your application’s client ID, issued when you registered your app with Flextell.
The URL Flextell will redirect the user back to after they grant (or deny) permission. Must exactly match one of the redirect URIs registered for your app.
A space-separated list of permissions your app is requesting (e.g.,
read:contacts write:messages).A random, unguessable string your app generates. Flextell echoes it back in the redirect so you can verify the response is legitimate and guard against CSRF attacks.
User logs in and grants permission
Flextell presents the user with a login screen (if they are not already authenticated) followed by a consent screen listing the permissions your app is requesting.If the user approves, Flextell redirects them to your
redirect_uri. If the user denies access, Flextell also redirects back but includes an error parameter instead of a code.Receive the authorization code
After the user grants permission, Flextell redirects to your Before proceeding, verify that the
redirect_uri with an authorization code and your original state value appended as query parameters:state value matches what you sent in step 1.Exchange the code for tokens
Make a A successful response returns the following JSON:
POST request from your server to the token endpoint:Must be
authorization_code.The authorization code received in the redirect.
The same
redirect_uri you used in step 1. Must match exactly.Your application’s client ID.
Your application’s client secret. Never expose this in client-side code or public repositories.
The token your app uses to authenticate API requests. Pass it as a Bearer token in the
Authorization header.Always
Bearer.Number of seconds until the access token expires.
A long-lived token used to obtain a new access token without requiring the user to log in again.
Refreshing an expired token
Access tokens expire after the duration indicated byexpires_in. When a token expires, the API returns a 401 Unauthorized response. Use the refresh token to obtain a new access token without requiring the user to log in again.
Send a POST request to the token endpoint with grant_type=refresh_token:
access_token and a new refresh_token.