access_token included directly in the URL fragment. This flow never issues a refresh token — when the token expires, the user has to authorize your app again.
Implementing the implicit grant
Step 1: Create an OAuth client
Go to Settings → API access → OAuth clients and create a new OAuth client. Configure:- Display name — a name to identify your OAuth client.
- Redirect URI whitelist — where users are redirected after authorization. See Redirect URIs for the rules governing this value.
- Access scopes — the scopes your app needs. See OAuth scopes for the full list.
- Client type — Web app.
Step 2: Redirect to the authorization endpoint
Example redirection to the Text OAuth server
Step 3: Get the access token from the URL
After the user clicks Allow, Text redirects them back to yourredirect_uri with access_token in the URL fragment:
Example redirection back to the app
Compare the returned
state with the value you sent in Step 2, and reject the response if they don’t match.
Step 4: Use the token in API calls
Extractaccess_token from the URL fragment and keep it in memory. Storing it in localStorage or a cookie leaves it readable by any script that runs on your page, including through XSS. Caching an in-memory token still avoids redirecting the user to the Text OAuth server on every visit within the same page session.