Guide to User Management
Guide to managing multiple users and their authentication using Composio.
Introduction to Entities
- Each unique user is represented by a unique entity id.
- If you have two users, Jessica and Melissa, they will have unique entity ids.
Introduction to Connected Accounts
- When a user connects their account, a
connected_account
object is created. - This object securely stores authentication data such as access tokens and refresh tokens.
Managing Entities
To retrieve an entity object using code, you can use the following code:
You can use the entity object to manage the connected accounts for the user. You can also use the entity object to perform actions on behalf of the user and connect accounts for the user.
Getting Connected Accounts
To get the connected accounts for an entity, you can use the following code:
This code attempts to retrieve the connected account for Github. If no connected account is found, it catches the exception and prints a message.
Performing Actions on Behalf of Users
Executing Actions without an Agent on behalf of a user
You can execute actions on behalf of a user without using an agent.
Performing Actions with an Agent on behalf of a user
You can use an agent to perform actions on behalf of a user.
In this example, an agent is configured to star a repository on GitHub on behalf of the user. The OpenAI API is used to process the request and perform the action.
Was this page helpful?