Entities
- Each user is represented by a unique entity ID.
- If you have two users, default and Melissa, they will each have unique entity IDs.
- You can use an entity object to manage connected accounts and perform actions on behalf of a user, learn more here. Here’s how to retrieve an entity object:
If entity ID is not specified,
default will be used as the entity ID.Connected Accounts
- When a user connects their account, a
connected_accountobject is created. - Connected Account securely stores authentication data such as API keys, access tokens and refresh tokens.
Integrations & Connections
Integration- An integration is your app’s configuration for services like Gmail or GitHub
- Each integration contains authentication method, API scopes, client credentials and other app settings
- Developers can create multiple integrations with different configurations, learn more here
- A connection links a user to an integration
- Multiple connections can be created for the same integration
- Learn how to use connections here
Initiating a new connection for your user
- OAuth-Based Apps
- Non OAuth-Based Apps
Initiate a new connection
Below are the accepted parameters for initiating a new connection:Connection request output:
integration_id: ID of the existing integration, use this to create a connection for an existing integration, If no integration exists for the given app, new one is automatically createdapp: name of the app to create a connection forlabels: labels to be assigned to the connection, which can later be used to filter connectionsentity_id: ID of the user for whom the connection is being createdredirect_url: URL to redirect the user to after the connection is created (for OAuth auth scheme). If not provided, the user will be redirected to Composio’s connection success/failer pageconnected_account_params/data: If auth mode is non-OAuth, this is where parameters need to be passed for creating a connection (API key, shopify store name, etc)auth_scheme: Type of authentication to be used for the connection (OAUTH2 or API_KEY, BASIC_WITH_JWT, etc), OAUTH2 will be defaulted if not providedauth_config: If auth mode is OAuth, this is where the configuration needs to be provided for creating a connection (client_id, client_secret, etc)
connectionStatus: status of the connection, initially it will be INITIATED and will change to ACTIVE or FAILED after user completes the auth flowconnectedAccountId: ID of the newly created account, you can use this ID to retrieve the connection objectredirectUrl: URL to redirect to perform authentication, post the authentication flow user will be redirect to the page specified in theredirectUrlparameter
Checking the status of the connection
Use the connectedAccountId to get the detailed information about the connection, learn more here.Status of the connection can be one of the following:
INITIATED: Connection is initiated but not yet completedACTIVE: Connection is active and ready to useFAILED: Connection failed to be created