If you are building an integration that accesses Connextify on behalf of other users, use our OAuth 2.0 service. We support standard Authorization Code flow with PKCE (Proof Key for Code Exchange) and Dynamic Client Registration.

The 5-step integration flow


Step 1: Register your application

If you are not using one of our pre-registered clients (openai or claude), register your client dynamically:
curl -X POST https://connextify.com/mcp/oauth/register \
  -H "Content-Type: application/json" \
  -d '{
    "client_name": "Acme Marketing Assistant",
    "redirect_uris": ["https://myapp.com/oauth/callback"],
    "grant_types": ["authorization_code", "refresh_token"],
    "response_types": ["code"],
    "scope": "shorturl:read shorturl:create qrcode:read qrcode:create analytics:read"
  }'
The response returns your credentials:
{
  "client_id": "connextify_client_abc123456",
  "client_secret": "sec_987654321xyz",
  "client_name": "Acme Marketing Assistant",
  "redirect_uris": ["https://myapp.com/oauth/callback"]
}
Save client_id and client_secret securely.

Step 2: Generate PKCE parameters and redirect user

PKCE prevents authorization code injection attacks. Always generate a cryptographically random code verifier and SHA-256 challenge for every login attempt.
// 1. Generate a random 32-byte verifier string
function generateCodeVerifier() {
  const bytes = new Uint8Array(32);
  crypto.getRandomValues(bytes);
  return btoa(String.fromCharCode(...bytes))
    .replace(/\+/g, '-')
    .replace(/\//g, '_')
    .replace(/=+$/, '');
}

// 2. Hash with SHA-256 to create the code challenge
async function generateCodeChallenge(verifier) {
  const data = new TextEncoder().encode(verifier);
  const digest = await crypto.subtle.digest('SHA-256', data);
  return btoa(String.fromCharCode(...new Uint8Array(digest)))
    .replace(/\+/g, '-')
    .replace(/\//g, '_')
    .replace(/=+$/, '');
}

async function startOAuthFlow() {
  const verifier = generateCodeVerifier();
  const challenge = await generateCodeChallenge(verifier);

  // Store verifier in sessionStorage to verify during the callback step
  sessionStorage.setItem('pkce_code_verifier', verifier);

  const authUrl = new URL('https://connextify.com/mcp/oauth/authorize');
  authUrl.searchParams.set('client_id', 'YOUR_CLIENT_ID');
  authUrl.searchParams.set('redirect_uri', 'https://myapp.com/oauth/callback');
  authUrl.searchParams.set('response_type', 'code');
  authUrl.searchParams.set('scope', 'shorturl:read shorturl:create');
  authUrl.searchParams.set('state', 'random_csrf_token_xyz');
  authUrl.searchParams.set('code_challenge', challenge);
  authUrl.searchParams.set('code_challenge_method', 'S256');

  window.location.href = authUrl.toString();
}

Step 3: Handle the redirect callback

Once the user approves your app, Connextify redirects back to your redirect_uri with code and state parameters:
https://myapp.com/oauth/callback?code=AUTH_CODE_HERE&state=random_csrf_token_xyz
Verify that the state matches your stored CSRF token before proceeding.

Step 4: Exchange code for tokens

Send a POST request to /mcp/oauth/token including the original code_verifier:
curl -X POST https://connextify.com/mcp/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code" \
  -d "code=AUTH_CODE_HERE" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET" \
  -d "redirect_uri=https://myapp.com/oauth/callback" \
  -d "code_verifier=ORIGINAL_CODE_VERIFIER"

Token response

{
  "access_token": "eyJhbGciOi...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "cnfy_rt_...",
  "scope": "shorturl:read shorturl:create"
}

Step 5: Refreshing expired tokens

Access tokens expire after 1 hour (3600 seconds). Use the refresh token to get a fresh access token without asking the user to log in again:
curl -X POST https://connextify.com/mcp/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=refresh_token" \
  -d "refresh_token=YOUR_STORED_REFRESH_TOKEN" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET"
Refresh Token Rotation: Every refresh response issues a new refresh token and invalidates the previous one. Always overwrite your stored refresh token with the latest value returned.

Pre-registered OAuth clients

If you are setting up common assistants, you can use our built-in client IDs instead of running dynamic registration:
Client IDPlatformGuide
openaiCustom GPTs & GPT ActionsGPT Actions Guide
claudeAnthropic Claude Web & DesktopMCP Setup

Common OAuth error responses

ErrorReason
invalid_requestRequired parameter is missing or callback URL doesn’t match registered list.
invalid_clientBad client_id or client_secret.
invalid_grantAuthorization code is invalid, already used, or expired (codes expire in 10 minutes).
invalid_scopeRequested scopes are invalid or malformed.
access_deniedThe user clicked “Cancel” on the consent screen.

Next steps

OAuth Scopes Reference

Check granular permissions for links, QR codes, and analytics →

Endpoints Reference

Detailed endpoint specifications and payload schemas →