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 devRegister 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).
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".
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
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.
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.
Authorize (browser redirect)
GET
/oauth/authorize
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.
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.
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.
An rfoa_ access token or rfor_ refresh token.
rfoa_QWNjZXNzVG9rZW5FeGFtcGxlWhich kind of token you are sending. Optional.
Your client ID. Required unless you send it in the HTTP Basic header.
YOUR_CLIENT_IDYour client secret, for apps set to client_secret_post.
rfcs_YOUR_CLIENT_SECRETThe token's state. An expired, revoked or unknown token returns only {"active": false}.
True when the token is live.
The OAuth client the token was issued to.
The Roboflow user id.
Space-separated scopes.
Expiry time in seconds since the Unix epoch.
Issue time in seconds since the Unix epoch.
Issuer, https://app.roboflow.com.
Bearer for an access token.
Workspace the token is bound to.
URL slug of that workspace.
invalid_request: the token parameter is missing.
invalid_client: the client is unknown or its secret is wrong.
Too many requests from this IP address.
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
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
stateon every callback.Never expose
client_secretor 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?