Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Cohere ai Cohere python ConnectorOAuth Model

From Leeroopedia
Revision as of 12:16, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Cohere_ai_Cohere_python_ConnectorOAuth_Model.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 /authorize endpoint URL for user authorization.
  • token_url -- The OAuth 2.0 /token endpoint 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

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

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment