For the complete documentation index, see llms.txt. This page is also available as Markdown.

Sign In With Roboflow (Developer Reference)

OAuth reference, visibility, errors, and example app for Sign in with Roboflow.

Reference for apps that use Sign in with Roboflow. For registering an app, PKCE, and the authorization flow, see Sign In With Roboflow (Getting Started).

Example App

roboflow/siwr_example_app is a small Node.js app that runs the full OAuth flow against app.roboflow.com and api.roboflow.com. Tokens stay in an Express session, and the browser never sees the client secret.

git clone https://github.com/roboflow/siwr_example_app.git
cd siwr_example_app
cp .env.example .env
# Set RF_CLIENT_ID, RF_CLIENT_SECRET, SESSION_SECRET
npm install && npm run dev

Register an OAuth app with the redirect URI http://localhost:3001/oauth/callback and the scopes the app uses (openid, profile, email, workspace:read, project:read, model:infer).

Route
Purpose

GET /

Landing page, or the dashboard once signed in

GET /oauth/start

Start OAuth with a PKCE redirect

GET /oauth/callback

Exchange the code and show the dashboard

POST /logout

Revoke the token and clear the session

PKCE and Authorize URL

From src/oauth.ts:

export function pkcePair(): { verifier: string; challenge: string } {
    const verifier = crypto.randomBytes(48).toString("base64url");
    const challenge = crypto.createHash("sha256").update(verifier).digest("base64url");
    return { verifier, challenge };
}

export function buildAuthorizeUrl(state: string, codeChallenge: string): string {
    const url = new URL(`${config.appHost}/oauth/authorize`);
    url.searchParams.set("response_type", "code");
    url.searchParams.set("client_id", config.clientId);
    url.searchParams.set("redirect_uri", config.redirectUri);
    url.searchParams.set("scope", REQUESTED_SCOPE_STRING);
    url.searchParams.set("state", state);
    url.searchParams.set("code_challenge", codeChallenge);
    url.searchParams.set("code_challenge_method", "S256");
    return url.toString();
}

GET /oauth/start stores verifier and state in the session, then redirects to this URL.

Callback and State Check

From src/server.ts:

Always clear one-time OAuth session data before you exchange the code. exchangeCodeForTokens posts the code, redirect_uri, code_verifier, client ID and client secret to the token endpoint.

Token Endpoint Authentication

Workspace OAuth apps are confidential clients: every call to the token, revoke and introspect endpoints carries the client secret. Pick the method that matches your client or gateway when you create or edit the app in "Workspace Settings > Developer".

Method
How it works

client_secret_post

Send client_id and client_secret as form fields in the request body. The default.

client_secret_basic

Send an HTTP Authorization: Basic header with the base64-encoded client_id:client_secret, and leave both out of the body.

Public clients, such as MCP connectors that register themselves, send only client_id and rely on PKCE.

Hosts

Service
Base URL

Sign-in, tokens, OIDC

https://app.roboflow.com

REST API

https://api.roboflow.com

Visibility

Controls which workspaces can sign in with your OAuth app.

Dashboard option
Who can sign in

Internal

Only members of the workspace that created the app

Unlisted

Any workspace that has your client ID

Public

Same as Unlisted, plus a listing in the Sign in with Roboflow directory when it is enabled

There is no separate "External" visibility type. Cross-workspace integrations use Unlisted.

Each customer workspace can also set an External OAuth apps policy: allow all, allow only listed client IDs, or block all. If sign-in fails outside your workspace, ask the customer to allow your client ID in their workspace settings.

Endpoints

All sign-in and token endpoints are on app.roboflow.com.

Purpose
Method
URL

Authorize (browser redirect)

GET

/oauth/authorize

POST

/oauth/token

POST

/oauth/revoke

GET

/oauth/userinfo

POST

/oauth/introspect

GET

/oauth/validate

OIDC discovery

GET

/.well-known/openid-configuration

JWKS, to verify id_token JWTs

GET

/.well-known/jwks.json

Introspect a Token

Returns whether a token is active and what it grants, using your client credentials. To check an access token without client credentials, use Validate a Token instead.

Introspect a token

post

Returns whether a token is active and what it grants (RFC 7662). The client authenticates the same way as on the token endpoint. A public client can only introspect its own tokens. To check an access token without client credentials, use the validate endpoint instead.

Authorizations
AuthorizationstringOptional

client_secret_basic: your client ID as the username and client secret as the password. Use it only when your OAuth app is set to client_secret_basic. Otherwise send client_id and client_secret in the form body.

Body
tokenstringRequired

An rfoa_ access token or rfor_ refresh token.

Example: rfoa_QWNjZXNzVG9rZW5FeGFtcGxl
token_type_hintstring · enumOptional

Which kind of token you are sending. Optional.

Possible values:
client_idstringOptional

Your client ID. Required unless you send it in the HTTP Basic header.

Example: YOUR_CLIENT_ID
client_secretstringOptional

Your client secret, for apps set to client_secret_post.

Example: rfcs_YOUR_CLIENT_SECRET
Responses
200

The token's state. An expired, revoked or unknown token returns only {"active": false}.

application/json
activebooleanRequired

True when the token is live.

client_idstringOptional

The OAuth client the token was issued to.

substringOptional

The Roboflow user id.

scopestringOptional

Space-separated scopes.

expintegerOptional

Expiry time in seconds since the Unix epoch.

iatintegerOptional

Issue time in seconds since the Unix epoch.

issstringOptional
token_typestringOptional

Bearer for an access token.

workspace_idstringOptional

Workspace the token is bound to.

workspace_urlstringOptional

URL slug of that workspace.

post/oauth/introspect
POST /oauth/introspect HTTP/1.1
Host: app.roboflow.com
Authorization: Basic username:password
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 145

"token='rfoa_QWNjZXNzVG9rZW5FeGFtcGxl'&token_type_hint='access_token'&client_id='YOUR_CLIENT_ID'&client_secret='rfcs_YOUR_CLIENT_SECRET'"
{
  "active": true,
  "client_id": "YOUR_CLIENT_ID",
  "sub": "user_abc123",
  "scope": "openid workspace:read project:read",
  "exp": 1893456000,
  "iat": 1893452400,
  "iss": "https://app.roboflow.com",
  "token_type": "Bearer",
  "workspace_id": "5f3Tq8k2ZbW1aXyZ",
  "workspace_url": "your-workspace"
}

Using Tokens on the REST API

Send Authorization: Bearer {access_token} to api.roboflow.com. See Authenticate with the REST API.

Common Errors

Response
Meaning
What to do

400 invalid_scope

A requested scope is not on the app's "Allowed scopes" list.

Add the scope in the dashboard, or remove it from the request.

400 invalid_grant

The code or refresh token is expired, used, or revoked, or the workspace no longer allows your app.

Send the user through sign-in again.

401 invalid_client

Wrong client ID or secret, or the secret is sent with the wrong method.

Check the app's token endpoint authentication setting.

401 OAuthException on api.roboflow.com

The access token expired or was revoked.

Refresh once, then send the user through sign-in again.

404 GraphMethodException on api.roboflow.com

The token lacks the route's scope, or the route is in a workspace the token is not bound to.

Ask the user to consent again with the scopes you need.

403 on api.roboflow.com

The user's role does not allow the action.

A workspace admin changes the user's role.

Redirect mismatch

redirect_uri does not match a registered redirect URI.

Fix the dashboard entry or your authorize URL.

Security

  • Use PKCE on every authorize request.

  • Check state on every callback.

  • Never expose client_secret or refresh tokens to the browser.

  • Revoke tokens when the user signs out.

  • Request only the scopes you need. See the full list in Available Scopes.

Last updated

Was this helpful?