Skip to main content

vantage_sdk.auth

Authentication and authorization functionality for the Vantage CLI.

Functions

extract_persona(token_set: vantage_sdk.schemas.TokenSet, settings: vantage_sdk.config.Settings | None = None) -> vantage_sdk.schemas.Persona

Extract a persona from an explicitly provided token set.

fetch_auth_tokens(ctx: vantage_sdk.schemas.SDKContext, status_callback: Callable[[str], NoneType] | None = None) -> vantage_sdk.schemas.TokenSet

Fetch an access token (and possibly a refresh token) from Auth0.

generate_pkce_pair() -> tuple[str, str]

Generate a PKCE code verifier and code challenge pair.

init_persona(*, access_token: str, refresh_token: str | None = None, settings: vantage_sdk.config.Settings | None = None) -> vantage_sdk.schemas.Persona

Initialize a persona from explicit token values without filesystem access.

is_token_expired(token: str, buffer_seconds: int = 300) -> bool

Check if a JWT token is expired or will expire within buffer_seconds.

refresh_access_token(ctx: vantage_sdk.schemas.SDKContext, token_set: vantage_sdk.schemas.TokenSet)

Attempt to fetch a new access token given a refresh token in a token_set.

refresh_access_token_standalone(token_set: vantage_sdk.schemas.TokenSet, settings: 'Settings') -> bool

Attempt to fetch a new access token given a refresh token.

refresh_token_if_needed(token_set: vantage_sdk.schemas.TokenSet, settings: vantage_sdk.config.Settings | None = None) -> vantage_sdk.schemas.TokenSet

Check if the access token is expired and refresh it if needed.

validate_token_and_extract_identity(token_set: vantage_sdk.schemas.TokenSet) -> vantage_sdk.schemas.IdentityData

Validate access token and extract user identity information.