Create a new OAuthClient instance.
OAuth configuration
OptionalauthorizationUrl?: stringOptionalscope?: string[]OptionaltokenUrl?: stringCheck if a user has already granted consent for the requested scopes.
Use this to determine if you can skip the consent screen for returning users.
User's email address
Consent status and optional redirect URL
Exchange an authorization code for access and refresh tokens.
Call this after the user is redirected back to your app with an authorization code. The tokens are automatically stored in the client for subsequent API calls.
The authorization code from the callback URL query parameter
The token set including access token, refresh token, and expiration
Get the current access token stored in the client.
The access token, or undefined if not authenticated
Generate the authorization URL for OAuth flow
Optionalstate: stringOptional CSRF protection state parameter
Optionaloptions: AuthorizationUrlOptionsOptional additional parameters (e.g., loginHint to pre-fill email)
The authorization URL to redirect users to
Get an access token using client credentials grant.
Use this for server-to-server authentication where no user context is needed. This is typically used for admin operations or background jobs.
Optionalscope: string[]Optional scopes to request; uses configured scopes if not provided
Token set (no refresh token for client credentials)
Get public partner app information.
This endpoint does not require authentication and is safe to call from frontend code. Use it to display partner branding on login screens.
Partner app public information (name, logo, etc.)
Get user information using an access token.
Returns OIDC standard claims about the authenticated user. Requires the 'openid' and 'profile' scopes.
OptionalaccessToken: stringOptional access token; uses stored token if not provided
User information including subject ID, email, name, and picture
Initiate partner passwordless authentication.
Starts the passwordless login flow by sending a verification code to the user's email. Use this for embedded authentication flows within your app.
User's email address
Optionalname: stringOptional user's name (used for new user provisioning)
Optionaloptions: InitiatePartnerAuthOptionsOptional shared workspace configuration
Options for initiating partner authentication with shared workspace support.
Optionalis_admin?: booleanWhen true, assigns WORKSPACE_ADMIN role instead of WORKSPACE_MEMBER
when joining a shared workspace. Ignored when workspace_id is not provided.
Optionalworkspace_id?: stringTarget workspace for the new user. If omitted, a personal workspace is created for the user (preserving current default behavior).
Session info for completing authentication
Introspect an access token to check its validity and metadata.
Since Contio uses opaque tokens (not JWTs), you cannot decode them locally. Use this method to check if a token is still valid and get its metadata.
The access token to introspect
Token metadata including active status, scopes, and expiration
Check if the current access token is expired.
true if the token is expired or expiration is unknown, false otherwise
Refresh the access token using a refresh token.
Access tokens expire after 24 hours. Use this method to get a new access token without requiring the user to re-authorize. Refresh tokens are valid for 30 days.
OptionalrefreshToken: stringOptional refresh token; uses stored token if not provided
New token set with fresh access token
Revoke an access or refresh token.
Use this when a user disconnects your app or you need to invalidate tokens. Revoked tokens cannot be used for API calls.
The token to revoke
Type of token: 'access_token' or 'refresh_token' (default: 'access_token')
Set tokens directly from storage.
Use this to restore tokens from your secure storage when initializing the client for a returning user.
Previously stored token set
Verify partner passwordless authentication.
Completes the passwordless login flow by verifying the code sent to the user's email.
User's email address
Verification code from email
Session ID from initiatePartnerAuth
Redirect URL to complete OAuth flow
OAuth 2.0 client for Contio Partner API authentication.
Supports authorization code flow, client credentials, token refresh, and token introspection. Tokens are opaque (not JWTs) for security.
Example