Overview
Scalev uses OAuth 2.0 Authorization Code with PKCE. The flow is split across two surfaces:- the merchant-facing authorization step starts on the Scalev frontend authorize page
- the token, introspection, revocation, and installation endpoints live on the
/v3/oauth/*API surface
- Register your application with Scalev
- Generate PKCE parameters
- Redirect the merchant’s browser to Scalev’s authorize page
- The merchant signs in and approves your app
- Your backend receives an authorization code
- Your backend exchanges the code for tokens
- Your backend uses the access token to call Scalev
/v3APIs - Your backend refreshes, introspects, or revokes tokens as needed
The authorize page is a frontend route, not a machine API endpoint. It is intentionally separate from the /v3 API contract.
URLs
Frontend Authorization URL
API Base URL
Step 0: Register and Prepare Your App
Before merchants can install your app, create and configure your OAuth application in Scalev. Important app fields include:client_idclient_secretredirect_uri- optional
manage_url - requested scopes
- optional webhook settings
- optional billing tags
- optional IP allowlist
redirect_urimust match exactlyclient_secretmust stay server-side- if your app uses webhook events, configure the app webhook settings correctly
- if your app supports merchant launch links from Scalev, set
manage_url - merchant installation is blocked until the app is verified
Step 1: Generate PKCE Parameters
Before redirecting the merchant, generate:- a
code_verifier - a
code_challengederived from that verifier using SHA-256 and Base64 URL encoding
Code Verifier Example (JavaScript)
Code Challenge Example (JavaScript)
code_verifier securely. You will need it during token exchange.
Step 2: Redirect the Merchant to Scalev
Redirect the merchant’s browser to:| Parameter | Required | Description |
|---|---|---|
client_id | Yes | Your OAuth app client ID |
redirect_uri | Yes | Must exactly match the configured redirect URI |
response_type | Yes | Must be code |
state | Yes | Random CSRF-protection value generated by your app |
code_challenge | Yes | Base64 URL encoded SHA-256 hash of the code verifier |
code_challenge_method | Yes | Must be S256 |
- PKCE is required
- only
S256is accepted - the authorize entrypoint is the frontend URL, not the
/v3API - if the merchant is not signed in, Scalev will take them through login and then return them to the authorize page with the same OAuth query parameters
Optional: Fetch Public App Metadata Before Redirect
If you want to preflight or display app metadata from your backend, call:client_idnamedescriptionlogo_urlhomepage_urlredirect_uri
Step 3: Merchant Reviews and Approves the App
On the Scalev authorize page, the merchant can review and approve:- the app identity
- the requested scopes
- webhook permissions, if applicable
- billing-tag approvals, if applicable
redirect_uri.
Step 4: Receive the Authorization Code
After approval, your backend callback receives:- verify the returned
state - exchange the code promptly
- authorization-code flow only
- code TTL is 10 minutes
- each code can be exchanged only once
Step 5: Exchange the Code for Tokens
From your backend, exchange the code at:| Field | Description |
|---|---|
access_token | Token used for authenticated /v3 API requests |
refresh_token | Token used to obtain a new access token |
token_type | Always Bearer |
expires_in | Access-token lifetime in seconds |
Step 6: Use the Access Token
Use the access token in theAuthorization header:
/v3 endpoints that match the granted scopes.
Useful First Checks
Token Introspection
Installation Status Snapshot
authorized_business_idclient_idis_activeis_enabledgranted_scopeswebhook_statusgranted_webhook_eventsapproved_billing_tagsmanage_launch_availableupdated_at
Step 7: Refresh Access Tokens
When the access token expires, use the refresh token:- always replace both the access token and the refresh token after a successful refresh
- refresh-token exchange is part of the
/v3/oauth/tokenflow - if the installation is disabled or revoked, refresh may fail
Token Lifecycle
Current behavior:- access token TTL: 1 hour
- refresh token TTL: 30 days
Token Revocation
To revoke a token:token_type values are:
accessrefresh
- HTTP
204 No Content
Optional: Merchant Manage Launch Flow
If your app defines amanage_url, Scalev can launch merchants into your app with a short-lived launch_token.
Exchange that token from your backend with:
/v3/oauth/installation/status.
Important notes:
- the
launch_tokenis one-time and short-lived - it is not an access token
- there is no shared manage-link secret; your backend authenticates the exchange with
client_idandclient_secret
Best Practices
- Redirect merchants to the frontend authorize page, not to a backend
/v2API endpoint. - Generate a new PKCE verifier and challenge for every install attempt.
- Validate
stateon every callback. - Keep
client_secret, access tokens, and refresh tokens on the server only. - Use only the scopes, webhook events, and billing tags your app actually needs.
- Treat
redirect_urias an exact-match value. - Use
/v3/oauth/installation/statuswhen you need the authoritative merchant install snapshot. - Use
/v3/oauth/introspectfor runtime token diagnostics. - Handle disabled installations separately from revoked installations.
Error Handling
OAuth endpoints may return errors such as:| Error Code | Description |
|---|---|
invalid_request | Missing or malformed request parameters |
invalid_client | Client authentication failed |
invalid_grant | Authorization code, refresh token, or PKCE verifier is invalid or expired |
unauthorized_client | The client is not allowed to use the requested grant type |
server_error | Unexpected server-side failure |
invalid_grantwhen the code verifier does not matchinvalid_requestwhen required PKCE parameters are missing or malformed

