Skip to content

API Reference parrot.auth.token_exchange

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

parrot.auth.token_exchange

View source

Exchange an external provider token for a Navigator session.

Class ExchangeResult

Outcome of one exchange attempt.

Parameter Type Default Description
ok bool
reason str REASON_OK
nav_user_id Optional[str] None
session_token Optional[str] None
email Optional[str] None
display_name Optional[str] None
provider_user_id Optional[str] None
expires_at Optional[str] None
raw Dict[str, Any] dict()

Fields:

Field Type Default Description
ok bool
reason str REASON_OK
nav_user_id Optional[str] None
session_token Optional[str] None
email Optional[str] None
display_name Optional[str] None
provider_user_id Optional[str] None
expires_at Optional[str] None
raw Dict[str, Any] field(default_factory=dict, repr=False)

Attribute REASON_BACKEND_NOT_LOADED

Attribute REASON_EXPIRED

Attribute REASON_INVALID_TOKEN

Attribute REASON_OK

Attribute REASON_TRANSPORT

Attribute REASON_USER_NOT_FOUND

Class TokenExchangeClient

POST an external token to Navigator's TokenExchangeAuth backend.

Proven end to end in sdd/state/FEAT-729/poc/exchange_run.transcript.md.

Parameter Type Default Description
auth_url str Navigator login endpoint.
timeout int 15 Total request timeout in seconds.
prefer_id_token bool True Include an available ID token in the exchange.

Method TokenExchangeClient.exchange

Exchange an external token for a Navigator session.

Transport failures do not escape. They return an unsuccessful result whose reason is transport_error.

exchange(token: str, *, provider: str = 'azure', id_token: Optional[str] = None, token_type: str = 'Bearer') -> ExchangeResult

Parameter Type Default Description
token str Provider access token.
provider str 'azure' External identity provider name.
id_token Optional[str] None Optional provider ID token.
token_type str 'Bearer' Access-token scheme.

Returns: ExchangeResult — The parsed exchange outcome.

Attribute logger

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