Getting Started
Connecting new accounts To get started with Multiple Account Authorizations, you can pass inallowMultipleCredentials
to paragon.installIntegration
:
paragon.getUser
to retrieve this list:
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
:
selectedCredentialId
to paragon.uninstallIntegration
:
Usage
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:- Use
user.integrations.[integration].allCredentials
(a field returned ingetUser
) to display multiple connected accounts in your Integrations UI. - Update references to
connect
(orinstallIntegration
anduninstallIntegration
) to use the SDK with Multiple Account Authorizations enabled. - Update references to
paragon.request
andparagon.workflow
(and API equivalents) to make sure that a specific account is targeted for a given integration type.
Reference
.getUser() -> ParagonUser
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.
.installIntegration(integrationType: string, options?: IntegrationInstallOptions) -> Promise
- Full docs: .installIntegration(integrationType: string, installOptions?: InstallOptions) -> Promise<IntegrationInstallEvent>
- Additional options: If
allowMultipleCredentials
is specified astrue
in theoptions
object, this function will not throw an error if the user already has this integration installed.
JavaScript SDK
selectedCredentialId
property. This option replaces the underlying connected account, keeping their enabled workflows and settings intact.
JavaScript SDK
.uninstallIntegration(integrationType: string, options?: IntegrationUninstallOptions) -> Promise
Call.uninstallIntegration()
to disconnect an integration for the authenticated user.
- Full docs: .uninstallIntegration(integrationType: string) -> Promise
- Additional options:
selectedCredentialId
(SDK) orX-Paragon-Credential
(API) can be used to select a specific account to uninstall.
.connect(integrationType: string, options: IntegrationInstallOptions) -> Promise
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.
- The Connect Portal can show the settings and workflows enabled for one account at a time, set by the
selectedCredentialId
property. IfselectedCredentialId
is not defined, the Connect Portal will use the first account available. - When the Connect Portal appears, a user can enable or disable workflows, update User Settings, and disconnect the account that is selected.
JavaScript SDK
.request(integrationType: string, path: string, requestOptions: RequestOptions) → Promise
Call.request
to send an API request to a third-party integration on behalf of one of your users.
- Full docs: #.request-integrationtype-string-path-string-requestoptions-requestinit-promise
- Additional options:
selectedCredentialId
(SDK) orX-Paragon-Credential
(API) can be used to select a specific account to use with the Proxy API.
.workflow(workflowId: string, options: FetchOptions)
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.
- Full docs: .workflow(workflowId: string, options: FetchOptions)
- Additional options:
selectedCredentialId
(SDK) orX-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.