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

    Class AutoAuthCredentialExchanger

    Automatically selects the appropriate credential exchanger based on the auth scheme. Ported from Python implementation.

    // Common case: a built-in exchanger handles the credential.
    const exchanger = new AutoAuthCredentialExchanger();
    const result = await exchanger.exchange({
    authScheme: serviceAccountScheme,
    authCredential: serviceAccountCredential,
    });
    // result.credential carries an OAuth token as a bearer token.
    // Use CustomAuthExchanger for OAuth2 instead of the built-in exchanger.
    const exchanger = new AutoAuthCredentialExchanger({
    [AuthCredentialTypes.OAUTH2]: new CustomAuthExchanger(),
    });

    Implements

    The exchanger used for each auth credential type.

    By default OAUTH2 and OPEN_ID_CONNECT run OAuth2CredentialExchanger and convert any access token with generateAuthToken, and SERVICE_ACCOUNT maps to a ServiceAccountCredentialExchanger, with any custom exchangers from the constructor merged over them. The map is live: an entry added or replaced after construction is used by the next exchange call.