Skip to main content

Background

OAuth (Open Authorization) is an open-standard framework for access delegation, allowing applications to securely access a user’s protected resources without exposing their login credentials. By keeping passwords private and limiting access to sensitive information, OAuth improves both security and access management across web, mobile, and desktop applications. OAuth 2.0, the current and most widely adopted version, expands upon the original protocol to support APIs, mobile apps, and connected devices, offering multiple authorization flows tailored to different application types.
Corti Assistant requires user-based authentication. Client credentials flows and other machine-to-machine authentication methods are NOT supported for embedded Corti Assistant integrations. You must authenticate as an end user, not as an application.
When embedding Corti Assistant in your application (via iFrame/WebView), it’s important to use the right OAuth2 grant type that supports user-based authentication. This guide explains the OAuth flows that work with embedded Corti Assistant, focusing on user-based authentication methods that are suitable for interactive scenarios.

Supported OAuth grant types for Embedded Corti Assistant

The following OAuth flows support user-based authentication and can be used with embedded Corti Assistant. Client credentials grant is NOT supported as it does not provide user context. Best for: Native apps, single-page apps, or any browser-based integration where a user is present. Why: This flow is secure, interactive, and doesn’t require a client secret (ideal for public clients). Proof Key for Code Exchange (PKCE) protects against code interception attacks. How it works:
  1. Your app redirects the user to Corti’s OAuth2 authorization server.
  2. The user logs in and grants permission.
  3. Corti redirects back with an authorization code.
  4. Your app exchanges the code (with the PKCE verifier) for an access token.
Key advantages:
  • Secure and suitable for embedded web apps.
  • No client secret is required.
  • Enforces user interaction.
This example uses the Corti JavaScript SDK (@corti/sdk)
Step 1: Generate Authorization URL (Frontend)
Step 2: Handle the Callback and Exchange Code for Tokens
Use this gold standard for Corti Assistant embedded use cases.

2. Authorization code flow (without PKCE)

Best for: Server-side web applications embedding Corti Assistant where the client secret can be safely stored on the backend. Why: Similar to PKCE, but requires storing a client secret — which is not safe in public or browser-based clients. Key Concerns:
  • Unsafe for apps where the frontend or iFrame can be inspected.
  • Only acceptable in secure backend environments where the client secret can be protected.
This example uses the Corti JavaScript SDK (@corti/sdk)
Step 1: Create Authorization URL
Step 2: Handle the Callback and Exchange Code for Tokens
Step 3: Exchange Code for Access Token (Backend)
Summary of the flow:Requirements:
  • Must use HTTPS for redirect_uri
  • Your client_secret must not be exposed to the frontend
  • The code returned is valid for one use and short-lived
Use only if the OAuth2 flow is entirely server-to-server.

3. Resource Owner Password Credentials (ROPC) grant (use with caution)

Best for: Controlled environments embedding Corti Assistant with trusted clients (e.g., internal tools). Why: Allows username/password login directly in the app — but bypasses the authorization server UI. Risks:
  • Trains users to enter passwords into third-party apps.
  • Easy to misuse, violates best practices.
  • Only viable where UI constraints prevent redirecting (e.g., native kiosk apps without browsers).
This example uses the Corti JavaScript SDK (@corti/sdk)
This authentication method is not recommended, but sometimes necessary.

Final guidance

Important: Embedded Corti Assistant requires user-based authentication. Client credentials grant is NOT supported as it does not provide user context.
Pick the flow that matches your interaction model as offered above. See further details and contact us for support here. What to use when:
  • For embedded Corti Assistant (e.g., in an iFrame/WebView):
    Use Authorization Code Flow with PKCE to authenticate the end user securely. This is the recommended flow for most embedded integrations.
  • For server-side integrations where you can securely store a client secret:
    Authorization Code Flow (without PKCE) may be used, but ensure the client secret is never exposed to the frontend.
  • For constrained environments without redirect capabilities:
    ROPC may be used with caution, but only in trusted internal environments.
  • Client Credentials is NOT supported — it does not provide user context and will not work with embedded Corti Assistant.
Additional reference: