ADK for TypeScript: API Reference
    Preparing search index...

    Interface AuthCredential

    Data class representing an authentication credential.

    To exchange for the actual credential, please use CredentialExchanger.exchangeCredential().

    // API Key Auth
    const authCredential: AuthCredential = {
    authType: AuthCredentialTypes.API_KEY,
    apiKey: "your_api_key",
    };
    // HTTP Auth
    const authCredential: AuthCredential = {
    authType: AuthCredentialTypes.HTTP,
    http: {
    scheme: "basic",
    credentials: {
    username: "user",
    password: "password",
    },
    }
    }
    // OAuth2 Bearer Token in HTTP Header
    const authCredential: AuthCredential = {
    authType: AuthCredentialTypes.HTTP,
    http: {
    scheme: "bearer",
    credentials: {
    token: "your_access_token",
    },
    }
    }
    // OAuth2 Auth with Authorization Code Flow
    const authCredential: AuthCredential = {
    authType: AuthCredentialTypes.OAUTH2,
    oauth2: {
    clientId: "your_client_id",
    clientSecret: "your_client_secret",
    }
    }

    @example:
    // Open ID Connect Auth
    const authCredential: AuthCredential = {
    authType: AuthCredentialTypes.OPEN_ID_CONNECT,
    oauth2: {
    clientId: "1234",
    clientSecret: "secret",
    redirectUri: "https://example.com",
    scopes: ["scope1", "scope2"],
    }
    }

    @example:
    // Auth with resource reference
    const authCredential: AuthCredential = {
    authType: AuthCredentialTypes.API_KEY,
    resourceRef: "projects/1234/locations/us-central1/resources/resource1"
    }
    interface AuthCredential {
        apiKey?: string;
        authType: AuthCredentialTypes;
        http?: HttpAuth;
        oauth2?: OAuth2Auth;
        resourceRef?: string;
        serviceAccount?: ServiceAccount;
    }

    Properties

    apiKey?: string
    http?: HttpAuth
    oauth2?: OAuth2Auth
    resourceRef?: string

    Resource reference for the credential. This will be supported in the future.

    serviceAccount?: ServiceAccount