OAuth Server
Official guide to Clearout OAuth 2.1 integration. Learn app registration, PKCE authorization flow, endpoint setup, and secure API access
Clearout's OAuth 2.1 server enables third-party applications to access Clearout services on a user's behalf with their explicit consent, without requiring the user's API key.
When to use the OAuth Server
Use OAuth 2.1 when you are building a third-party application that needs to access Clearout on behalf of another Clearout user.
Examples:
A CRM app that verifies email addresses using the connected user's Clearout credits.
An automation platform that triggers Clearout workflows after receiving user consent.
A data-enrichment tool that accesses permitted Clearout services without handling the user's API key.
If you are building an internal integration and already control the Clearout account credentials, use an API key with the Clearout REST API instead.
Before you begin
Ensure that you have:
A Clearout account with access to the Developer Console.
Permission to register an OAuth application.
At least one redirect URI for your application (use HTTPS in production).
The Clearout scopes required by your integration.
Server metadata
Clearout publishes its OAuth endpoints and capabilities at the standard discovery URL. Prefer reading endpoints from here over hard-coding them.
Authorization
https://app.clearout.io/oauth/authorize
Token
https://clearout.io/oauth2/token
Registration
https://clearout.io/oauth2/register
Register your application
Enter application details
Enter an application name and choose the application type:
Public — apps that cannot keep a secret (single-page, mobile, desktop, CLI). No client secret is issued.
Confidential — apps with a secure backend. A client secret is issued.
The application type cannot be changed after the app is created.
Scopes
Request only the minimum scopes required by your integration.
all_products
Use Clearout product APIs: email verifier, email finder, reverse lookup, name validation, company lookup, and domain lookup
account
Read account information, subscription plans, credits, and service limits
Request multiple scopes as a space-separated list, for example scope=all_products account. If you omit scope, the user is asked to approve every scope your application is registered for.
Authorization flow
Clearout supports the OAuth 2.1 authorization-code flow with PKCE (S256 only).
Authorization request
Redirect the user to:
Example:
If the user approves, Clearout redirects to:
If the user denies, Clearout redirects to:
Exchange the authorization code
Exchange the authorization code at Clearout's token endpoint.
The redirect_uri must exactly match the one used in the authorization request.
Public clients must not send a client_secret.
Example response:
Authorization code
10 minutes
Access token
7 days (604800 s)
Refresh token
30 days
Call Clearout APIs
Send the access token in the Authorization header:
Example:
Each API requires a specific scope. If the token lacks it, Clearout returns 403 insufficient_scope with the required scope in the response. APIs outside the OAuth scopes are not available to OAuth access tokens.
Refresh access tokens
Access tokens expire. When a token expires, use the refresh token to obtain a new access token. Confidential clients must authenticate the same way as in the code exchange.
You may pass an optional scope to request a narrower set of the originally approved scopes.
Follow these rules:
Store refresh tokens securely.
Every refresh returns a new refresh token and invalidates the old one — always replace the stored token.
Treat a reused or invalid refresh token as a potential security event.
Do not request scopes beyond those originally approved by the user; doing so returns
invalid_scope.
Revoke access
A Clearout user can disconnect an OAuth application from Authorized Clients in their account settings. Revoking access immediately invalidates that connection's access tokens and refresh tokens. If the application owner deletes the OAuth app, access is revoked for every connected user.
Applications should handle authorization failures (invalid_token, invalid_grant) gracefully and prompt the user to reconnect.
Security requirements
Use HTTPS for all redirect URIs in production.
Use the authorization-code flow with PKCE (
S256).Use an exact redirect URI match.
Generate a unique
stateparameter for every authorization request and validate it on callback.Store client secrets and refresh tokens in a secure secret store.
Request only the minimum required scopes.
Do not place access tokens or refresh tokens in URLs, logs, browser storage, or client-side code.
OAuth errors
Authorization and token errors
invalid_request
A required parameter is missing (code, redirect_uri, code_verifier, or refresh_token)
Fix the request
invalid_client
Client ID or client secret is missing or invalid, the app was deleted, or a public client sent a secret
Verify app credentials and app type
invalid_grant
Authorization code or refresh token is invalid, expired, reused, revoked, or does not match the client or redirect URI, or PKCE verification failed
Restart authorization or refresh flow
invalid_scope
Requested scope is unsupported, not allowed for the app, or exceeds the originally approved scopes
Request valid scopes
unsupported_grant_type
grant_type is not authorization_code or refresh_token
Use a supported grant type
access_denied
User denied the consent request (returned on the redirect URI)
Show a reconnect or cancellation flow
API call errors
These are returned with a WWW-Authenticate: Bearer header.
401
invalid_token
Access token is invalid, expired, or revoked
Refresh the token or prompt to reconnect
403
insufficient_scope
Token lacks the required scope, or the API is not available via OAuth
Request the required scope
Last updated
Was this helpful?

