The Accounts API manages OAuth connections to external services like Google, GitHub, and Notion. These accounts enable widgets to access user data from integrated services.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mvriu5/forge/llms.txt
Use this file to discover all available pages before exploring further.
Supported Providers
google- Google OAuth integrationgithub- GitHub OAuth integrationnotion- Notion OAuth integration
Get Connected Accounts
Retrieve all connected OAuth accounts for the authenticated user.Response
Returns an array of connected account objects.Unique account identifier
Provider-specific account ID
OAuth provider:
google, github, or notionID of the user who connected this account
OAuth access token (sensitive - handle with care)
OAuth refresh token (sensitive - handle with care)
OpenID Connect ID token
Access token expiration timestamp
Refresh token expiration timestamp
OAuth scopes granted
Account connection timestamp
Last update timestamp
- Success (200)
- Error (401)
Update Account
Update a connected account’s refresh token.Request Body
OAuth provider:
google, github, or notionNew refresh token for the account
Response
Returns the updated account object.- Success (200)
- Error (400)
- Error (404)
Delete Account
Disconnect an OAuth account.Query Parameters
OAuth provider to disconnect:
google, github, or notionResponse
Returns the deleted account object.- Success (200)
- Error (400)
- Error (404)
OAuth Flow
Connecting a new account typically follows this flow:- Initiate OAuth - User clicks “Connect [Provider]” in the UI
- Redirect to Provider - User is redirected to the OAuth provider’s authorization page
- Authorization - User grants permissions
- Callback - Provider redirects back to Forge with authorization code
- Token Exchange - BetterAuth exchanges the code for access/refresh tokens
- Account Created - Account record is created in the database
- Widget Access - Widgets can now use the account to access provider APIs
- View connected accounts
- Update refresh tokens when needed
- Disconnect accounts
Token Refresh
Access tokens expire periodically. When a widget needs to use an expired token:- Detect token expiration (check
accessTokenExpiresAt) - Use the refresh token to obtain a new access token
- Update the account using
PUT /api/accounts