White-labelling

Guide to white-labelling the OAuth Flow

Using custom auth app (aka white-labelling)

When going to production, it’s recommended to use your own developer credentials.

1

Set up a 301 redirect

The endpoint https://backend.composio.dev/api/v1/auth-apps/add is what captures the user’s credentials to manage the auth. However, OAuth consent screens show the callback URL - and if it isn’t the same as your application, that creates distrust.

It’s recommended to specify the redirect URL to your own domain and create a redirect logic, either through your DNS or in your application to redirect that endpoint to https://backend.composio.dev/api/v1/auth-apps/add

Whether using DNS or application-level redirects, ensure you’re preserving the query string and all params and headers are forwarded correctly

This diagram shows the entire redirect sequence.

2

Create the integration

Create your integration, specifying the redirect URL in the auth configuration.

Make sure to set the use_composio_oauth_app / useComposioAuth flag to False!

Refer to the concepts page for more information on how to retrieve the auth configuration for an integration.

1from composio_openai import App, ComposioToolSet
2
3toolset = ComposioToolSet()
4integration = toolset.create_integration(
5 app=App.GOOGLECALENDAR,
6 auth_mode="OAUTH2",
7 use_composio_oauth_app=False,
8 auth_config={
9 "client_id": "12345678",
10 "client_secret": "12345678",
11 "redirect_uri": "https://yourapp.com/redirect"
12 }
13)
14
15entity = toolset.get_entity("default")
16
17connection_request = entity.initiate_connection(
18 app_name=App.GOOGLECALENDAR, integration=integration
19)
20print(connection_request)
3

Create the connection

Now you can create the connection. Make sure to include the redirectUri parameter and set it to where the user should be redirected to after the auth process is finished.

1user_id = "00000000-0000-0000-0000-000000000000"
2entity = toolset.get_entity(user_id)
3
4thread_id = "12345678"
5redirect_url = "https://yourapp.com/thread/{thread_id}" # Example redirect URL
6
7conn_req = entity.initiate_connection(
8 app_name=App.GOOGLECALENDAR,
9 auth_mode="OAUTH2",
10 use_composio_auth=False,
11 redirect_url=redirect_url
12)
13
14print(conn_req.redirect_url)

The connection request returns a redirect URL that you can emit to the user to start the auth process. They see the custom consent screen that you configured. In this case, it’s “usefulagents.com”