Skip to main content

Configuration interfaces

export interface MioClientSDKInitConfig {
  clientId: string;
  redirectUrl: string;
  exchangeTokenUrl: string;
}

export interface MioServerSDKInitConfig
  extends Pick<MioClientSDKInitConfig, 'clientId' | 'redirectUrl'> {
  clientSecret: string;
}

Shared fields

clientId
string
required
OAuth application ID from the Mio dashboard. Exposed to the browser.
redirectUrl
string
required
Absolute URL where Mio sends users back after the connection flow. Must match the redirect configured in the Mio dashboard.

Client-only fields

exchangeTokenUrl
string
required
Backend endpoint that swaps authorization codes for tokens on behalf of the browser.

Server-only fields

clientSecret
string
required
Confidential secret used only on the server when exchanging or refreshing tokens.

Token response schema

export interface MioOauth2TokenResponse {
  accessToken: string;
  refreshToken: string;
  idToken: string;
  expiresIn: number;
  tokenType: string;
}
accessToken
string
required
Short-lived token for Mio Context requests.
refreshToken
string
required
Use it to mint new access tokens.
idToken
string
required
JWT that contains user identity claims.
expiresIn
number
required
Seconds until the access token expires.
tokenType
string
default:"Bearer"
HTTP scheme for the Authorization header.

Context response schema

export type MioChatResponse = string;
The SDK validates the context payload with Zod (MioChatResponseSchema) and returns the string directly so you can render it without parsing.