Skip to content

API Reference

The Flowsta Auth API provides OAuth 2.0 + PKCE authentication endpoints.

Base URL

https://auth-api.flowsta.com

Authentication Methods

EndpointAuthentication
/oauth/authorizeNone (public)
/oauth/tokenPKCE (client_id + code_verifier)
/oauth/userinfoBearer token
/oauth/revokeX-Client-Id header

No Client Secret Required

Flowsta uses PKCE, which provides security without client secrets. Your Client ID is all you need!

OAuth Endpoints

Authorization Endpoint

http
GET /oauth/authorize

Start the OAuth flow by redirecting users here.

Parameters:

ParameterRequiredDescription
response_typeMust be code
client_idYour Client ID
redirect_uriCallback URL
scopeSpace-separated scopes
state⚠️CSRF protection (recommended)
code_challengePKCE challenge
code_challenge_methodMust be S256

Example:

https://auth-api.flowsta.com/oauth/authorize?
  response_type=code&
  client_id=flowsta_app_abc123&
  redirect_uri=https://yourapp.com/callback&
  scope=profile%20email&
  state=random_state&
  code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&
  code_challenge_method=S256

Token Endpoint

http
POST /oauth/token
Content-Type: application/json

Exchange authorization code for tokens.

Request Body:

json
{
  "grant_type": "authorization_code",
  "code": "authorization_code_here",
  "redirect_uri": "https://yourapp.com/callback",
  "client_id": "flowsta_app_abc123",
  "code_verifier": "your_pkce_code_verifier"
}

Response:

json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "refresh_token_here",
  "scope": "profile email"
}

User Info Endpoint

http
GET /oauth/userinfo
Authorization: Bearer <access_token>

Get authenticated user's profile.

Response:

json
{
  "sub": "550e8400-e29b-41d4-a716-446655440000",
  "name": "John Doe",
  "preferred_username": "johndoe",
  "did": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK",
  "agent_pub_key": "uhCAk7JpEWfkiV...",
  "profile_picture": "https://...",
  "has_custom_picture": false,
  "email": "john@example.com",
  "email_verified": true,
  "scope": "profile email"
}

Token Revocation

http
POST /oauth/revoke
Content-Type: application/json
X-Client-Id: flowsta_app_abc123

Revoke a refresh token.

Request Body:

json
{
  "token": "refresh_token_here",
  "token_type_hint": "refresh_token"
}

Scopes

ScopeData Included
profilesub, name, preferred_username, did, agent_pub_key, profile_picture
emailemail, email_verified (requires user permission)

Error Responses

400 Bad Request:

json
{
  "error": "invalid_request",
  "error_description": "Missing required parameter: code_verifier"
}

401 Unauthorized:

json
{
  "error": "invalid_token",
  "error_description": "Access token is invalid or expired"
}

Token Lifetimes

Token TypeLifetime
Authorization Code10 minutes
Access Token1 hour
Refresh Token30 days (sliding)

Rate Limiting

EndpointLimit
/oauth/authorize100/min per IP
/oauth/token50/min per client
/oauth/userinfo500/min per token
/oauth/revoke50/min per client

Headers:

http
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1699564800

SDK Usage

We recommend using the official SDK instead of calling the API directly:

typescript
import { FlowstaAuth } from '@flowsta/auth';

const auth = new FlowstaAuth({
  clientId: 'flowsta_app_abc123',
  redirectUri: 'https://yourapp.com/callback'
});

// Redirect to Flowsta login
auth.login();

// Handle callback (PKCE handled automatically)
const user = await auth.handleCallback();

View SDK Documentation →

Complete OAuth Documentation

For detailed OAuth documentation including:

  • PKCE implementation guide
  • Framework-specific examples (React, Vue, Qwik)
  • Security best practices
  • Session management

View OAuth Documentation →

Support

Need help with the API?

Documentation licensed under CC BY-SA 4.0.