1
---
2
-title: Move from a Composio-managed app to your own OAuth app
2
+title: Move to your own OAuth app
3
description: Register your own OAuth app, route new connections to it, reconnect existing users, and recreate their triggers
4
keywords: [migrate, managed auth, own oauth app, custom auth config, bring your own app, reconnect, white label, provider quota]
5
---
6
7
-This guide is for apps that already have users connected through a [Composio-managed app](/toolkits/managed-auth) and want to switch a toolkit to their own OAuth app. To decide whether you need to, read [Managed vs custom auth](/docs/authentication/custom-app-vs-managed-app).
7
+Use this guide when you're ready to move a toolkit to your own OAuth app, for example for dedicated rate limits or your own name on the consent screen. Managed connections keep working while you switch, so you can move on your own schedule. To decide whether to move, read [Managed vs custom auth](/docs/authentication/custom-app-vs-managed-app) and [Avoid and recover from rate limits](/docs/poc-to-prod/avoid-rate-limits).
8
9
You move one toolkit at a time. Each toolkit gets its own auth config, so Gmail can move while Slack stays on the managed app.
10
213
<Step>
214
<StepTitle>Recreate triggers on the new connection</StepTitle>
215
216
-Triggers stay attached to the managed connected account. List them, create the same trigger type and config on the new connected account, then disable the old instance:
216
+Triggers stay attached to the managed connected account. List them and create each one on the new connected account with the same trigger config, delivery type, and polling interval. Keep a map from each old trigger ID to its new one:
217
218
<Tabs groupId="language" items={['Python', 'TypeScript', 'API']} persist>
219
<Tab value="Python">
226
connected_account_ids=["ca_old_managed_account"],
227
)
228
229
+new_trigger_ids = {}
230
for trigger in old_triggers.items:
230
- composio.triggers.create(
231
+ new_trigger = composio.triggers.create(
232
slug=trigger.trigger_name,
233
connected_account_id="ca_new_own_app_account",
234
trigger_config=trigger.trigger_config,
235
+ # A fallback to polling is left for Composio to decide again
236
+ type=None if trigger.fallback_reason else trigger.type,
237
+ polling_interval=trigger.polling_interval,
238
)
235
- composio.triggers.disable(trigger_id=trigger.id)
239
+ new_trigger_ids[trigger.id] = new_trigger.trigger_id
240
+
241
+# After your event filters use the new IDs, disable the old instances
242
+for old_trigger_id in new_trigger_ids:
243
+ composio.triggers.disable(trigger_id=old_trigger_id)
244
```
245
</Tab>
246
<Tab value="TypeScript">
253
connectedAccountIds: ['ca_old_managed_account'],
254
});
255
256
+const newTriggerIds = new Map<string, string>();
257
for (const trigger of oldTriggers.items) {
249
- await composio.triggers.create('user_123', trigger.triggerName, {
258
+ const newTrigger = await composio.triggers.create('user_123', trigger.triggerName, {
259
connectedAccountId: 'ca_new_own_app_account',
260
triggerConfig: trigger.triggerConfig,
261
+ // A fallback to polling is left for Composio to decide again
262
+ type: trigger.fallbackReason ? undefined : trigger.type,
263
+ pollingInterval: trigger.pollingInterval ?? undefined,
264
});
253
- await composio.triggers.disable(trigger.id);
265
+ newTriggerIds.set(trigger.id, newTrigger.triggerId);
266
+}
267
+
268
+// After your event filters use the new IDs, disable the old instances
269
+for (const oldTriggerId of newTriggerIds.keys()) {
270
+ await composio.triggers.disable(oldTriggerId);
271
}
272
```
273
</Tab>
275
```bash
276
# List triggers on the managed connection
277
curl -s "https://backend.composio.dev/api/v3.1/trigger_instances/active?connected_account_ids=ca_old_managed_account" \
261
- -H "x-api-key: $COMPOSIO_API_KEY" | jq '.items[] | {id, trigger_name, trigger_config}'
278
+ -H "x-api-key: $COMPOSIO_API_KEY" | jq '.items[] | {id, trigger_name, trigger_config, type, fallback_reason, polling_interval}'
279
280
# For each one, create the same trigger type on the new connection.
264
-# Use its trigger_name in the URL and copy its trigger_config into the body.
281
+# Use its trigger_name in the URL. Copy its trigger_config and polling_interval,
282
+# and its type unless fallback_reason is set. Save the returned trigger_id.
283
curl -X POST https://backend.composio.dev/api/v3.1/trigger_instances/GMAIL_NEW_GMAIL_MESSAGE/upsert \
284
-H "x-api-key: $COMPOSIO_API_KEY" \
285
-H "Content-Type: application/json" \
268
- -d '{"user_id": "user_123", "connected_account_id": "ca_new_own_app_account", "trigger_config": {}}'
286
+ -d '{"user_id": "user_123", "connected_account_id": "ca_new_own_app_account", "trigger_config": {}, "type": "poll", "polling_interval": 15}' \
287
+ | jq '{trigger_id, type, polling_interval}'
288
270
-# Then disable the old instance
289
+# After your event filters use the new trigger_id, disable the old instance
290
curl -X PATCH https://backend.composio.dev/api/v3.1/trigger_instances/manage/ti_old_trigger \
291
-H "x-api-key: $COMPOSIO_API_KEY" \
292
-H "Content-Type: application/json" \
295
</Tab>
296
</Tabs>
297
279
-Results are cursor-paginated. If the list returns a next cursor, fetch the next page as shown in [Listing active triggers](/docs/setting-up-triggers/managing-triggers#listing-active-triggers). Polling triggers on your own app can use shorter intervals than the managed minimum where the toolkit supports it.
298
+Results are cursor-paginated. If the list returns a next cursor, fetch the next page as shown in [Listing active triggers](/docs/setting-up-triggers/managing-triggers#listing-active-triggers).
299
+
300
+Events from the new triggers carry the new trigger ID and connected account ID. Before you disable the old instances, update anything that matches on the old values: [event subscriptions filtered by trigger ID](/docs/setting-up-triggers/subscribing-to-events), webhook handlers, and any stored links between a user and their trigger or connected account.
301
302
Disable the old trigger rather than deleting it until you've confirmed events arrive from the new one. Otherwise both instances fire for the same event while they overlap.
303
</Step>
305
<Step>
306
<StepTitle>Retire the managed connections</StepTitle>
307
287
-After a user's new connection works, [disable](/docs/auth-configuration/connected-accounts#enable-and-disable-accounts) their managed connected account. Disabling an account also disables its triggers, and you can re-enable it if something goes wrong. Once you're confident, [delete the old triggers](/docs/setting-up-triggers/managing-triggers#deleting-triggers) and [delete the managed connected account](/docs/auth-configuration/connected-accounts#delete-accounts). Deletion is permanent.
308
+After a user's new connection works, [disable](/docs/auth-configuration/connected-accounts#enable-and-disable-accounts) their managed connected account. Disabling an account also disables its triggers, and you can re-enable it if something goes wrong.
309
+
310
+Once you're confident, clean up in this order:
311
289
-To revoke the upstream token as well, use [Revoke accounts](/docs/auth-configuration/connected-accounts#revoke-accounts) where the toolkit supports it.
312
+1. Optionally, [revoke the upstream token](/docs/auth-configuration/connected-accounts#revoke-accounts) where the toolkit supports it. Revoking needs the connected account to still exist, so do it before you delete.
313
+2. [Delete the old triggers](/docs/setting-up-triggers/managing-triggers#deleting-triggers).
314
+3. [Delete the managed connected account](/docs/auth-configuration/connected-accounts#delete-accounts). This removes it from Composio and is permanent.
315
316
When no active connections remain on the managed config, every user is on your app. You can then pass your config in every session and drop the routing logic.
317
</Step>
330
## Next
331
332
<Cards>
308
- <Card icon={<Key />} title="Managed vs custom auth" href="/docs/authentication/custom-app-vs-managed-app" description="What a managed app limits and when to move" />
333
+ <Card icon={<Key />} title="Managed vs custom auth" href="/docs/authentication/custom-app-vs-managed-app" description="What changes with your own app and when it makes sense" />
334
+ <Card icon={<Zap />} title="Avoid and recover from rate limits" href="/docs/poc-to-prod/avoid-rate-limits" description="Spot which limit you hit, retry well, and shape traffic" />
335
<Card icon={<Palette />} title="White-labeling authentication" href="/docs/authentication/white-labeling-authentication" description="Brand the Connect Link and configure callback URLs" />
336
</Cards>