campaigns:read scope, so the first token cannot
change anything.
Only calling the API for your own company?
Create a scoped Platform API key instead. There is no callback URL, browser
redirect, consent screen, or token exchange.
Before you start
You need:- A SideShift account and a company with an active subscription
- A callback URL in your application
curlandopensslfor the commands below
http://127.0.0.1:3000/oauth/callback. Redirect URIs must use HTTPS in production; HTTP is
allowed only for localhost, 127.0.0.1, [::1], and explicitly supported native callbacks.
Userinfo, fragments, and wildcard bind addresses are rejected. Authorization matches the
registered callback exactly, except a native HTTP loopback callback may vary only the port
(RFC 8252 §7.3) — so the value must otherwise be identical in every step.
This quickstart uses a public client with no client secret. PKCE protects the authorization
code, while your backend must still keep access tokens, refresh tokens, and the registration
access token private.
Optional: discover the endpoints instead of hard-coding them
Optional: discover the endpoints instead of hard-coding them
SideShift publishes the two standard discovery documents at the domain root, so a client
can resolve every endpoint at runtime rather than pinning the paths below.This is authorization-server metadata (RFC 8414).
code_challenge_methods_supported confirms
S256 is the only PKCE method, and authorization_response_iss_parameter_supported means the
authorize redirect carries an iss parameter per RFC 9207 that you should check against
issuer.The companion document is protected-resource metadata (RFC 9728):resource is the canonical resource identifier and the audience your access tokens are bound
to. Both documents also list every supported scope.1. Register your application
Register once to get aclient_id. This example asks only to read campaigns and includes the
refresh_token grant so the integration can stay connected.
2. Send the user to SideShift
First, create a one-time PKCE verifier, its SHA-256 challenge, and a randomstate value:
stateexactly matches$SIDESHIFT_STATEissis exactlyhttps://app.sideshift.app
code
from the browser’s address bar for this manual test.
3. Exchange the code for tokens
Authorization codes are short-lived and single-use. Copy thecode from the callback and
exchange it from your backend with the same callback URL and PKCE verifier:
4. Make your first API request
Send the access token as a bearer token:data array is a successful result when the connected company has no campaigns.
5. Refresh the connection
When the access token expires, exchange the refresh token for a new token pair:Common errors
OAuth protected resource errors include a
requestId. OAuth registration, authorization,
and token endpoints instead use { error, error_description }. Include requestId when it
is present and you contact SideShift support.
Before going live
- Use an HTTPS callback URL and compare it by exact string; a native loopback HTTP callback is the only exception, and may vary only the port.
- Store tokens and the registration access token in a secrets manager, never client-side code.
- Request only the scopes your integration needs.
- Verify
stateandissbefore exchanging the authorization code. - Persist each rotated refresh token before discarding the previous one.
Next
Platform API
Browse capabilities, scopes, and the OAuth reference.
Authentication
Compare credentials, base URLs, and error formats.
MCP server
Use the same OAuth grant with an AI agent.