Setup a user-facing OAuth flow to create integration connections on Blaxel.
Some Blaxel integrations support OAuth-based authentication. You can automate such a flow to allow multiple users (tenants) to go through an OAuth flow and each have their integration.This approach is particularly useful when you need to automate the creation of dedicated MCP servers for each tenant with customized access permissions. This guide takes the example of creating such a flow for a Gmail integration.
Choose a name. It will be displayed when your user logins through Google
The redirect URIs will be the URL where your user will be redirected to after Google authorizes the request. It must be server-side as it will need to access secret credentials.
Finish creating the application. You’ll be given you a client_id and client_secret: keep them securely.
Scopes are used to request sufficient access on the user’s account. In this example, we want to connect his account to the MCP server to send emails.
Go to Data access
Click on “Add or remove scopes”
Add gmail.send
Some scopes (like this one) require an HTTPS callback URL. You won’t be able to test them easily locally without using ngrok or a similar tool which allows you to have an HTTPS URL bound to your localhost.
By default, it will work with your own account without any review by Google. You can look for the Audience tab on left to add more users. To make it global, you will need to launch a review process from Google with the “Publish app” button.
We recommend creating a separate OAuth flow specifically for the Gmail integration. Don’t simply add the Gmail scope to an existing OAuth flow, as this would require all users to grant email permissions even when they don’t need Gmail functionality.