Skip to content

API Reference parrot.auth.oauth2.persistence

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.auth.oauth2.persistence

View source

DocumentDB persistence layer for OAuth2 integrations.

users_integrations Durable credential records keyed by (user_id, provider). One row per user per provider; upserts on token refresh.

The patterns here mirror :mod:parrot.handlers.mcp_persistence — same DocumentDb context-manager, same $set / $setOnInsert upsert idiom.

Alias DocumentDb

Re-exported from parrot.interfaces.documentdb.DocumentDb.

Attribute USERS_INTEGRATIONS_COLLECTION

Type: str

Alias UsersIntegrationRow

Re-exported from parrot.auth.oauth2.models.UsersIntegrationRow.

Function delete_users_integration

Hard-delete the credential record for (user_id, provider).

A no-op if the record does not exist.

delete_users_integration(user_id: str, provider: str) -> None

Parameter Type Default Description
user_id str Navigator user identifier.
provider str Provider identifier, e.g. "jira".

Function get_users_integration

Fetch a single credential record by (user_id, provider).

get_users_integration(user_id: str, provider: str) -> Optional[UsersIntegrationRow]

Parameter Type Default Description
user_id str Navigator user identifier.
provider str Provider identifier, e.g. "jira".

Returns: Optional[UsersIntegrationRow] — class:~parrot.integrations.oauth2.models.UsersIntegrationRow if found, otherwise None.

Function list_users_integrations

Return all provider connections stored for a principal.

Invalid documents are logged and skipped so one malformed persisted record does not prevent a principal's other connections from being listed.

list_users_integrations(user_id: str) -> List[UsersIntegrationRow]

Parameter Type Default Description
user_id str Navigator user identifier.

Returns: List[UsersIntegrationRow] — Valid connection rows for the principal.

Attribute logger

Function upsert_users_integration

Upsert a credential record in users_integrations.

The composite key is (user_id, provider). A second call with the same key performs last-write-wins update of all other fields.

upsert_users_integration(row: UsersIntegrationRow) -> None

Parameter Type Default Description
row UsersIntegrationRow The credential record to persist.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally