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

Sign In With Roboflow (Getting Started)

Let users sign in to your application with their Roboflow account using OAuth 2.1 and PKCE.

You can let users sign in to your application with their Roboflow account, using the OAuth 2.1 authorization code flow with PKCE. Your app then acts for that user, limited to the permissions they approve.

OAuth access tokens work on api.roboflow.com with Authorization: Bearer. See Authenticate with the REST API for details.

For hosts, visibility, errors, and a runnable sample app, see Sign In With Roboflow (Developer Reference).

Create an OAuth App

To register your application:

1

Open Developer Settings

Go to "Workspace Settings > Developer" in your Roboflow dashboard at app.roboflow.com.

Developer settings with OAuth applications
2

Create a new OAuth app

Click "Create OAuth App" (or "New app") and fill in:

Field
Description

Name

Display name on the consent screen and in your OAuth apps list.

Homepage URL

Your product URL. Shown on the consent screen for information.

Redirect URIs

One or more callback URLs. Each must match the redirect_uri your code sends exactly.

Token endpoint authentication

How your app sends its secret to the token endpoint: client_secret_post (in the request body, the default) or client_secret_basic (in an HTTP Basic Authorization header). Most MCP gateways (ex: Azure, TrueFoundry) use client_secret_basic.

Allowed scopes

Every scope you will request at sign-in.

Visibility

Internal, Unlisted, or Public. See Visibility.

OAuth applications list on the Developer page
Create OAuth application form

You get a Client ID and a Client Secret (rfcs_…). The secret is shown only once, so store it on your server.

Redirect URI Examples

Redirect URI
Typical use

http://localhost:3001/oauth/callback

Local development on port 3001

http://127.0.0.1:3001/oauth/callback

The same, if your app uses 127.0.0.1

https://yourapp.com/oauth/callback

Production

Public hosts need HTTPS. HTTP works only for loopback addresses (localhost, 127.0.0.1, ::1).

Authorization Flow

Roboflow uses the authorization code grant with PKCE (Proof Key for Code Exchange). Every client must use PKCE with the S256 method.

1

Generate a PKCE code verifier and challenge

Create a random code_verifier (43 to 128 characters) and derive a code_challenge from it with SHA-256:

import hashlib, base64, secrets

code_verifier = secrets.token_urlsafe(32)
code_challenge = base64.urlsafe_b64encode(
    hashlib.sha256(code_verifier.encode()).digest()
).rstrip(b"=").decode()
2

Redirect the user to authorize

Send the user's browser to the Roboflow authorization URL:

https://app.roboflow.com/oauth/authorize?
  client_id=YOUR_CLIENT_ID&
  redirect_uri=https://yourapp.com/callback&
  response_type=code&
  scope=openid profile email workspace:read&
  code_challenge=YOUR_CODE_CHALLENGE&
  code_challenge_method=S256&
  state=YOUR_STATE_VALUE

Use a random state value and check it on the callback. Roboflow does not require state, but your app needs it to block forged callbacks. Keep code_verifier on your server until you exchange the code.

The user sees a consent screen with the permissions your app asked for, and picks the workspace to grant.

OAuth consent screen with workspace selection and scopes

After they approve, Roboflow redirects to your redirect_uri with code and state.

3

Exchange the code for tokens

On your server (never in the browser), send the code and your code_verifier to the token endpoint with grant_type=authorization_code. The code is single use and expires after 60 seconds, so exchange it right away. See Get or Refresh Tokens.

Tokens

Get or Refresh Tokens

The token endpoint handles both the code exchange and refreshes. Send grant_type=authorization_code with the code from the callback, or grant_type=refresh_token with a refresh token.

An access token lasts 1 hour (24 hours for MCP clients) and a refresh token 30 days. When the access token expires, refresh it. If the refresh fails with invalid_grant, send the user through sign-in again.

Get or refresh tokens

post

Exchanges an authorization code for tokens (grant_type=authorization_code), or a refresh token for a new access token (grant_type=refresh_token). Call it from your server, never from the browser. Workspace OAuth apps authenticate with their client secret, in the body (client_secret_post, the default) or in an HTTP Basic header (client_secret_basic), whichever the app is set to. Public MCP clients send only client_id and rely on PKCE. Rate limited per IP address.

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
or
Responses
200

Tokens issued.

application/json
access_tokenstringRequired

Opaque rfoa_ token for api.roboflow.com, sent as Authorization: Bearer. It is bound to the workspace the user picked on the consent screen.

token_typeconst: BearerRequired
expires_inintegerRequired

Seconds until the access token expires: 3600 (1 hour), or 86400 (24 hours) for MCP clients.

refresh_tokenstringOptional

rfor_ token for grant_type=refresh_token. Valid for 30 days. A refresh can return a new refresh token once the current one nears expiry: always store the value from the latest response.

id_tokenstringOptional

Signed RS256 JWT with identity claims. Only returned when openid was granted. Verify it with the JWKS at /.well-known/jwks.json.

scopestringOptional

Space-separated scopes the access token carries.

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

"grant_type='text'&code='rfoc_Qm9ndXNDb2RlRXhhbXBsZQ'&redirect_uri='https://yourapp.com/oauth/callback'&code_verifier='dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk'&client_id='YOUR_CLIENT_ID'&client_secret='rfcs_YOUR_CLIENT_SECRET'"
{
  "access_token": "rfoa_QWNjZXNzVG9rZW5FeGFtcGxl",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "rfor_UmVmcmVzaFRva2VuRXhhbXBsZQ",
  "id_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "scope": "openid profile email workspace:read"
}

Use an Access Token

Send the access token in the Authorization header on api.roboflow.com:

Validate a Token

Checks an access token's status and expiry without client credentials. Resource servers that receive rfoa_ tokens (ex: an MCP server) use it to cache a token until it expires.

Validate an access token

get

Checks an rfoa_ access token without client credentials: the token authenticates itself. A well-formed request always returns 200, and a dead token reports active false, so you can tell a dead token from an unreachable server. Cache the result until exp.

Authorizations
AuthorizationstringRequired

An rfoa_ OAuth access token.

Responses
200

The token's state.

application/json
activebooleanRequired

True when the token is live. When false, every other field is null or empty.

expinteger · nullableRequired

Expiry time in seconds since the Unix epoch.

workspace_urlstring · nullableRequired

URL slug of the workspace the token is bound to.

workspace_idstring · nullableRequired

Id of that workspace.

user_idstring · nullableRequired

The Roboflow user the token acts for.

granted_scopesstring[]Required

Scopes granted when the user consented. Use it only to rule a request out early.

scopesstring[]Required

Scopes the token carries now. Authoritative: a scope can be removed before the token expires.

get/oauth/validate
GET /oauth/validate HTTP/1.1
Host: app.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "active": true,
  "exp": 1893456000,
  "workspace_url": "your-workspace",
  "workspace_id": "5f3Tq8k2ZbW1aXyZ",
  "user_id": "user_abc123",
  "granted_scopes": [
    "workspace:read",
    "project:read"
  ],
  "scopes": [
    "workspace:read",
    "project:read"
  ]
}

Revoke a Token

Revokes an access token or a refresh token. Call it when the user signs out of your app.

Revoke a token

post

Revokes an access token or a refresh token (RFC 7009). The client authenticates the same way as on the token endpoint. Call it when the user signs out. Rate limited per IP address.

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 is revoked. The body is empty. An unknown or already revoked token also returns 200.

No content

post/oauth/revoke
POST /oauth/revoke 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'"

No content

Get User Info

Returns the signed-in user's profile. The token needs the openid scope.

Get user info

get

Returns the signed-in user's identity claims (OpenID Connect UserInfo). The access token must carry the openid scope. Add profile for name and email, or email for email alone.

Authorizations
AuthorizationstringRequired

An rfoa_ OAuth access token.

Responses
200

The user's claims.

application/json
substringRequired

Stable Roboflow user id.

namestringOptional

Display name. Requires profile.

emailstringOptional

Email address. Requires email or profile.

get/oauth/userinfo
GET /oauth/userinfo HTTP/1.1
Host: app.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "sub": "user_abc123",
  "name": "Ada Lovelace",
  "email": "ada@example.com"
}

Available Scopes

Your app can request any combination of these scopes. Each one must also be on your OAuth app's "Allowed scopes" list.

Identity Scopes

Scope
Description

openid

Returns a stable user ID in the sub claim. Needed for an id_token and for user info.

profile

Read the user's display name and email address.

email

Read the user's email address.

API Scopes

Scope
Description

workspace:read

Read workspace details, list projects

project:create

Create projects

project:read

Read project details

project:update

Update project settings

image:create

Upload images

image:read

Read and download images

image:tag

Add and remove image tags

image:annotate

Create and update annotations

model:infer

Run inference

model:deploy

Deploy models

model:manage

Manage model settings

model-eval:read

Read model evaluation results

workflow:create

Create Workflows

workflow:read

Read Workflows

workflow:update

Update Workflows

version:create

Create dataset versions

version:read

Read dataset versions

version:update

Update dataset versions

training-job:create

Start training jobs

folder:create

Create project folders

folder:read

Read project folders

folder:update

Update project folders

folder:delete

Delete project folders

Additional scopes
Scope
Description

device:read

Read devices

device:update

Update device settings

vision-events:read

Read vision events

vision-events:write

Create vision events

vision-events:manage

Manage vision event use cases

annotation-job:create

Create annotation jobs

annotation-job:read

Read annotation jobs

video-inference-job:create

Create video inference jobs

video-inference-job:read

Read video inference jobs

integration:create

Create integrations

integration:delete

Delete integrations

credentials:create

Create credentials

credentials:read

Read credentials

credentials:update

Update credentials

credentials:delete

Delete credentials

data-staging:read

Read staged data

data-staging:write

Write staged data

data-staging:delete

Delete staged data

batch-processing:read

Read batch jobs

batch-processing:trigger

Trigger batch processing

batch:read

Read batches

workspace-stats:read

Read workspace statistics

OIDC Discovery

Roboflow publishes standard OpenID Connect discovery documents. OAuth and OIDC client libraries read them to find the endpoints above.

  • OpenID Configuration: https://app.roboflow.com/.well-known/openid-configuration

  • JWKS, for verifying ID tokens: https://app.roboflow.com/.well-known/jwks.json

Next Steps

Last updated

Was this helpful?