Authentication Methods
Cobo CLI supports three authentication methods:- API Key
- User Access Token
- Organization Access Token
auth command.
User Login
To log in as a user and obtain a user access token, use the following command:- The CLI will display a browser URL, a token URL, and a code.
- You’ll be prompted to open a browser to continue the authorization process.
- If you confirm, your default browser will open with the provided URL.
- Complete the authorization process in your browser, granting the necessary permissions for the Cobo CLI app to access your crypto wallets.
- The CLI will poll the token URL for the granted token.
- Once authenticated, your user access token will be saved in the environment file (default: ~/.cobo/.env).
Organization Login
To log in as an organization and obtain an organization access token, use the following command:<YOUR_ORG_UUID> with your actual organization UUID.
This command will:
- Prompt you to open a browser for authorization.
- Guide you through the process of granting permissions for the Cobo CLI app to access your organization’s resources.
- Retrieve and save the organization token in the environment file.
Refreshing Organization Token
To refresh an existing organization token, add the--refresh-token flag:
Logout
To remove the access tokens obtained via login, use the logout command:cobo logout --user: Remove only the user access tokencobo logout --org: Remove only the organization access tokencobo logout --all: Remove both user and organization access tokens (default behavior)
Switching Authentication Methods
To switch between authentication methods, use theauth command:
<METHOD> with one of the following:
apikey: Use API Key authenticationuser: Use User Access Token authenticationorg: Use Organization Access Token authentication
API Key Authentication
For information on generating and managing API keys, please refer to the Key Management guide.Best Practices
- Keep your credentials and access tokens secure and never share them.
- Use environment variables or a secure configuration file to store sensitive information.
- Regularly refresh your tokens and rotate your API keys to maintain security.
- Use the appropriate authentication method based on your use case and security requirements.
