# Interface AuthCredential

Data class representing an authentication credential.

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

#### Example

    // API Key Auth
    const authCredential: AuthCredential = {
      authType: AuthCredentialTypes.API_KEY,
      apiKey: "your_api_key",
    };

#### Example

    // HTTP Auth
    const authCredential: AuthCredential = {
      authType: AuthCredentialTypes.HTTP,
      http: {
        scheme: "basic",
        credentials: {
          username: "user",
          password: "password",
        },
      }
    }

#### Example

    // OAuth2 Bearer Token in HTTP Header
    const authCredential: AuthCredential = {
      authType: AuthCredentialTypes.HTTP,
      http: {
        scheme: "bearer",
        credentials: {
          token: "your_access_token",
        },
      }
    }

#### Example

    // 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;
}

- Defined in auth/auth_credential.ts:240

## Properties

### `Optional` apiKey

apiKey?: string

- Defined in auth/auth_credential.ts:249

### authType

authType: AuthCredentialTypes

- Defined in auth/auth_credential.ts:241

### `Optional` http

http?: HttpAuth

- Defined in auth/auth_credential.ts:250

### `Optional` oauth2

oauth2?: OAuth2Auth

- Defined in auth/auth_credential.ts:252

### `Optional` resourceRef

resourceRef?: string

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

- Defined in auth/auth_credential.ts:247

### `Optional` serviceAccount

serviceAccount?: ServiceAccount

- Defined in auth/auth_credential.ts:251