What you’ll learn:
- How to create a Provider Setup Session to authorize a user
- How to store and reuse Provider Auth Configs
- Advanced patterns (BYO OAuth)
The OAuth Flow
Each user authorizes once. You store their Provider Auth Config ID in your database and reuse it for future sessions. The flow:- Create a Provider Setup Session for the provider
- Redirect your user to the session URL to complete OAuth
- Poll or webhook until the session status is
completed - Store the resulting Provider Auth Config ID for that user
- Pass the auth config ID when creating sessions for that user
Creating a Provider Setup Session
Create a setup session specifying the provider, auth method, and optionally a redirect URL to send the user back to after they authorize.url field—redirect your user to this URL.
Waiting for Completion
| Status | Meaning |
|---|---|
pending | User hasn’t completed the flow yet |
completed | User authorized successfully—auth config is ready |
expired | Session expired before the user completed it |
failed | An error occurred during the flow |
archived | Session was manually deleted |
Using an Auth Config in Sessions
Pass the stored Provider Auth Config ID when creating a session. Metorial uses it to authenticate tool calls on behalf of the user.Multiple OAuth Providers
You can attach multiple providers—each with their own auth config—to a single session:Advanced Features
Enterprise BYO (Bring Your Own) OAuth
Need OAuth consent screens to show your company name? You can register your own OAuth app with the provider (GitHub, Slack, Google, etc.) and create a provider deployment that uses your credentials instead of Metorial’s defaults. See Enterprise BYO for the setup steps.What’s Next?
SDK OAuth Guide
SDK documentation for handling OAuth flows.
API Guide
Learn about the Metorial API.
API Key Integrations
Simpler integrations without OAuth.