- Authorization Code + Client Secret: For web applications with a backend server
- Authorization Code + PKCE: For native apps, CLI tools, SPAs, and other public clients that cannot securely store a client secret
- Device Authorization Grant: For clients that cannot receive a browser redirect at all, such as a CLI running over SSH, in a container, or in a cloud IDE
Creating an OAuth App
- Go to Settings > OAuth Apps in your Teable account.
- Click New OAuth Apps to create a new application.
-
Fill in the required information:
- OAuth App name: A descriptive name for your application
- Homepage URL: The full URL to your application’s website
- Callback URL: The URL where users will be redirected after authorization
- Scopes: The permissions your application needs
- Enable device flow: Off by default. Turn it on only if your application signs users in with a device code
- After creating the app, generate a Client Secret. Make sure to copy and store it securely - you won’t be able to see it again.
You’ll receive a Client ID and need to generate a Client Secret. Keep these credentials secure and never expose them in client-side code. If using the PKCE flow, a client secret is not required.
Available Scopes
Scopes define what actions your OAuth App can perform. Available scopes are organized by resource type:OAuth 2.0 Authorization Code Flow
Teable implements the standard OAuth 2.0 Authorization Code flow:Step 1: Redirect Users to Authorization
Direct users to the authorization endpoint with your application parameters:
Example:
Step 2: User Authorization
Users will see an authorization page showing:- Your application name and logo
- The requested permissions (scopes)
- Options to approve or deny access
Step 3: Handle the Callback
After the user approves (or denies), Teable redirects to your callback URL: On success:Step 4: Exchange Code for Tokens
Exchange the authorization code for access and refresh tokens:
Example Request:
PKCE Authorization Flow
PKCE (Proof Key for Code Exchange) is designed for applications that cannot securely store a client secret, such as native desktop apps, mobile apps, CLI tools, or single-page applications.Step 1: Generate PKCE Parameters
Before initiating authorization, the client needs to generate a pair of PKCE parameters:Step 2: Redirect Users to Authorization
Example:
Step 3: Handle the Callback
Same as the standard authorization code flow - after user approval, the authorization code is returned via redirect.Step 4: Exchange Code + code_verifier for Tokens
PKCE mode does not require
client_secret. The code_verifier is used instead to verify the client’s identity.Device Authorization Flow
The Device Authorization Grant (RFC 8628) is for clients that cannot receive a browser redirect: a CLI running over SSH, inside a container, or in a cloud IDE. Your client shows a URL and a short code, the user approves in any browser, and nothing is typed back into the terminal. Teable follows RFC 8628, so most OAuth client libraries can drive this flow without custom code. What follows is what is specific to Teable.Request a Device Code
POST /api/oauth/device/code with your client_id and an optional scope. The endpoint is anonymous and rate limited to 30 requests per 15 minutes per IP address.
BACKEND_OAUTH_DEVICE_CODE_EXPIRE_IN), and interval is the minimum seconds to wait between polls.
Print the verification_uri and the user_code. On that page the user signs in, enters the code, and reviews your app’s name, homepage, and requested scopes before approving or denying. The page warns them not to approve a code they did not start themselves. Each code can be used once.
Teable does not return
verification_uri_complete, and your client should not build one. An approved code signs the approver into their own Teable account, so a link that already carries the code is exactly what device-code phishing relies on.Poll for Tokens
POST /api/oauth/access_token with grant_type=urn:ietf:params:oauth:grant-type:device_code, the device_code, and your client_id. Public clients send no client_secret; confidential clients add it as in the other flows.
Until someone approves the code, the endpoint answers with an error instead of tokens:
Once the user approves, the response is the same token payload as the other flows.
Using Access Tokens
Include the access token in theAuthorization header for API requests:
baseId from the response for subsequent API calls.
Refreshing Access Tokens
When an access token expires, use the refresh token to obtain a new one:
Example Request:
Revoking Access
For OAuth App Owners
Revoke the app’s access for all users (only the app creator can do this):For Users
Revoke your own authorization for a specific app:For Applications
Applications can revoke their own access using an Access Token:This endpoint only accepts Access Token authentication, not session authentication.
Token Expiration
Error Handling
Common error responses:Best Practices
- Choose the right mode: Use client secret mode for web apps with a backend, PKCE mode for native apps/CLI/SPA, and device flow when the client cannot receive a browser redirect
- Store secrets securely: Never expose your Client Secret in client-side code
- Use state parameter: Always include a random
stateparameter to prevent CSRF attacks - Request minimal scopes: Only request permissions your application actually needs
- Handle token refresh: Implement automatic token refresh before expiration
- Secure token storage: Store access and refresh tokens securely on your server

