Implementation:Cohere ai Cohere python ConnectorOAuth Model
| Knowledge Sources | |
|---|---|
| Domains | SDK, Connectors, OAuth |
| Last Updated | 2026-02-15 14:00 GMT |
Overview
ConnectorOAuth is a Pydantic model representing the OAuth 2.0 configuration associated with a registered Cohere connector.
Description
The ConnectorOAuth model stores the OAuth 2.0 credentials and endpoint URLs needed for user authorization when accessing an external data source through a connector. It contains:
- client_id -- The OAuth 2.0 client ID, encrypted at rest.
- client_secret -- The OAuth 2.0 client secret, encrypted at rest and never returned in API responses.
- authorize_url -- The OAuth 2.0
/authorizeendpoint URL for user authorization. - token_url -- The OAuth 2.0
/tokenendpoint URL for exchanging authorization codes for tokens. - scope -- The OAuth scopes to request during authorization.
This model is embedded within the Connector model as the oauth field and represents the read-only view of OAuth configuration for an existing connector.
Usage
Use ConnectorOAuth when inspecting the OAuth 2.0 configuration of an existing connector. This model is returned as part of connector responses from the Cohere API. To create or update OAuth configuration, use CreateConnectorOAuth instead.
Code Reference
Source Location
- Repository: Cohere Python SDK
- File:
src/cohere/types/connector_o_auth.py
Signature
class ConnectorOAuth(UncheckedBaseModel):
client_id: typing.Optional[str] = pydantic.Field(default=None)
client_secret: typing.Optional[str] = pydantic.Field(default=None)
authorize_url: str = pydantic.Field()
token_url: str = pydantic.Field()
scope: typing.Optional[str] = pydantic.Field(default=None)
Import
from cohere.types import ConnectorOAuth
I/O Contract
Fields
| Field | Type | Required | Description |
|---|---|---|---|
client_id |
Optional[str] |
No | The OAuth 2.0 client ID. Encrypted at rest. |
client_secret |
Optional[str] |
No | The OAuth 2.0 client secret. Encrypted at rest and never returned in a response. |
authorize_url |
str |
Yes | The OAuth 2.0 /authorize endpoint URL for user authorization.
|
token_url |
str |
Yes | The OAuth 2.0 /token endpoint URL for exchanging authorization codes.
|
scope |
Optional[str] |
No | The OAuth scopes to request when users authorize the connector. |
Usage Examples
from cohere.types import ConnectorOAuth
# Access OAuth configuration from an existing connector
connector = client.connectors.get(id="my-connector-id")
if connector.oauth:
oauth = connector.oauth
print(f"Client ID: {oauth.client_id}")
print(f"Authorize URL: {oauth.authorize_url}")
print(f"Token URL: {oauth.token_url}")
print(f"Scope: {oauth.scope}")
# Note: client_secret is never returned in responses