Use Provider Setup Sessions to authorize users with OAuth-based providers like Slack, GitHub, and Google.
OAuth integrations let users authorize access to their personal accounts—like Slack workspaces, GitHub repos, or Google Calendars—so your AI can perform actions on their behalf.
Metorial only provides managed OAuth credentials for a subset of popular providers (e.g., Slack, GitHub). Other providers in the catalog may require you to register your own OAuth app and use Enterprise BYO. Check the provider’s page in the catalog to see which auth methods are available.
What you’ll learn:
How to create a Provider Setup Session to authorize a user
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
In the dashboard, OAuth-based integration setup asks you to select or create auth credentials after you choose the provider auth method. For GitHub, the hosted OAuth option appears as GitHub.com; for Linear, it appears as OAuth.
Creating auth credentials starts a third-party authorization flow. Only continue when the user or account owner has approved connecting that GitHub, Linear, Slack, Google, or other third-party account.
Create a setup session specifying the provider, auth method, and optionally a redirect URL to send the user back to after they authorize.
let setupSession = await metorial.providers.setupSessions.create({ providerId: 'your-slack-provider-id', providerAuthMethodId: 'oauth', redirectUrl: 'https://yourapp.com/oauth/callback'});// Redirect your user to this URLconsole.log('Authorize here:', setupSession.url);
setup_session = await metorial.providers.setup_sessions.create( provider_id="your-slack-provider-id", provider_auth_method_id="oauth", redirect_url="https://yourapp.com/oauth/callback")# Redirect your user to this URLprint(f"Authorize here: {setup_session.url}")
// Waits until the user completes OAuth — returns the completed setup sessionlet completedSetup = await metorial.waitForSetupSession([setupSession]);// Store the auth config ID in your databaseawait db.users.update(userId, { slackAuthConfigId: completedSetup.authConfig.id });
# Waits until the user completes OAuth — returns the completed setup sessioncompleted = await metorial.wait_for_setup_session(setup_session)# Store the auth config ID in your databaseawait db.users.update(user_id, slack_auth_config_id=completed.auth_config.id)
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.