Skip to main content
What you’ll learn:
  • How OAuth works with Metorial
  • Creating Provider Setup Sessions
  • Storing and reusing Provider Auth Configs
External resources:
OAuth lets your users authorize access to their accounts on services like Slack, GitHub, Google Calendar, and more. This enables your AI agents to perform actions on behalf of your users with their explicit permission.

How OAuth Works

The OAuth flow uses Provider Setup Sessions:
  1. Create a Provider Setup Session for the provider the user needs to authorize
  2. Redirect the user to the session URL to complete OAuth in their browser
  3. Wait for completion — returns the completed setup session with an auth config
  4. Store the Provider Auth Config ID for that user in your database
  5. Pass the auth config ID when creating sessions for that user

Creating Provider Setup Sessions

Waiting for Completion

Using Auth Configs in Sessions

Retrieve the stored auth config ID from your database and pass it when creating a session:

Multiple OAuth Services

You can combine multiple OAuth-enabled providers in a single session:

Complete Example

What’s Next?

Provider Examples

See how to use OAuth with different AI providers.

OAuth Integrations

Learn about OAuth-enabled integrations in the catalog.