Use the SDK to connect multiple accounts for the same integration.
Multiple Account Authorizations is a set of SDK options that enables you to connect multiple accounts of the same integration type for a Connected User.
For example, one Connected User can connect a Google Calendar integration for both their Google Workspace account and personal Google account.
Connecting new accounts
To get started with Multiple Account Authorizations, you can pass in allowMultipleCredentials
to paragon.installIntegration
:
This function starts the connection process for a new account of an integration. After the user has connected, you can optionally show the Connect Portal for presenting any User Settings that are used to configure the integration.
Listing accounts
Your UI must be able to render a list of each account your user has connected for an integration. Use paragon.getUser
to retrieve this list:
Each account (“credential”) will have an ID that can be used to present the Connect Portal for the account, remove the account, or route requests to the account.
Use paragon.subscribe
to listen for change events to the Paragon user object, if your UI updates dynamically.
Managing existing accounts
You can allow your users to manage User Settings for a specific account using the Connect Portal by passing selectedCredentialId
to paragon.connect
:
Removing existing accounts
You can disconnect an existing account by passing selectedCredentialId
to paragon.uninstallIntegration
:
A subset of SDK functions can be passed an additional parameter for Multiple Account Authorizations, as outlined below.
In general, to use Multiple Account Authorizations, you will need to:
user.integrations.[integration].allCredentials
(a field returned in getUser
) to display multiple connected accounts in your Integrations UI.connect
(or installIntegration
and uninstallIntegration
) to use the SDK with Multiple Account Authorizations enabled.paragon.request
and paragon.workflow
(and API equivalents) to make sure that a specific account is targeted for a given integration type.App Events and Workflows do not need to be updated to support Multiple Account Authorizations.
Call .getUser
to retrieve the currently authenticated user and their connected integration state.
With Multiple Account Authorizations, the getUser()
method additionally returns allCredentials
, an array of connected accounts for a given integration.
allowMultipleCredentials
is specified as true
in the options
object, this function will not throw an error if the user already has this integration installed.You can use the resulting Promise to get the newly created credential.
Replacing an account
You can replace one of your user’s existing connected accounts with the selectedCredentialId
property. This option replaces the underlying connected account, keeping their enabled workflows and settings intact.
Call .uninstallIntegration()
to disconnect an integration for the authenticated user.
selectedCredentialId
(SDK) or X-Paragon-Credential
(API) can be used to select a specific account to uninstall.With Multiple Account Authorizations, use .connect
to present the Connect Portal for an existing account for the intended integration. .installIntegration
is used to connect new accounts.
selectedCredentialId
property. If selectedCredentialId
is not defined, the Connect Portal will use the first account available.Call .request
to send an API request to a third-party integration on behalf of one of your users.
selectedCredentialId
(SDK) or X-Paragon-Credential
(API) can be used to select a specific account to use with the Proxy API.Call .workflow()
to trigger a Paragon workflow that sends a custom response back to your app. Note: The workflow must be enabled and use a Request-type trigger.
selectedCredentialId
(SDK) or X-Paragon-Credential
(API) can be used to select a specific account to trigger a workflow for. The Credential ID that is used will be recorded for viewing in Task History.