Data class representing an authentication credential.
To exchange for the actual credential, please use CredentialExchanger.exchangeCredential().
// API Key Authconst authCredential: AuthCredential = { authType: AuthCredentialTypes.API_KEY, apiKey: "your_api_key",}; Copy
// API Key Authconst authCredential: AuthCredential = { authType: AuthCredentialTypes.API_KEY, apiKey: "your_api_key",};
// HTTP Authconst authCredential: AuthCredential = { authType: AuthCredentialTypes.HTTP, http: { scheme: "basic", credentials: { username: "user", password: "password", }, }} Copy
// HTTP Authconst authCredential: AuthCredential = { authType: AuthCredentialTypes.HTTP, http: { scheme: "basic", credentials: { username: "user", password: "password", }, }}
// OAuth2 Bearer Token in HTTP Headerconst authCredential: AuthCredential = { authType: AuthCredentialTypes.HTTP, http: { scheme: "bearer", credentials: { token: "your_access_token", }, }} Copy
// OAuth2 Bearer Token in HTTP Headerconst authCredential: AuthCredential = { authType: AuthCredentialTypes.HTTP, http: { scheme: "bearer", credentials: { token: "your_access_token", }, }}
// OAuth2 Auth with Authorization Code Flowconst authCredential: AuthCredential = { authType: AuthCredentialTypes.OAUTH2, oauth2: { clientId: "your_client_id", clientSecret: "your_client_secret", }}@example:// Open ID Connect Authconst authCredential: AuthCredential = { authType: AuthCredentialTypes.OPEN_ID_CONNECT, oauth2: { clientId: "1234", clientSecret: "secret", redirectUri: "https://example.com", scopes: ["scope1", "scope2"], }}@example:// Auth with resource referenceconst authCredential: AuthCredential = { authType: AuthCredentialTypes.API_KEY, resourceRef: "projects/1234/locations/us-central1/resources/resource1"} Copy
// OAuth2 Auth with Authorization Code Flowconst authCredential: AuthCredential = { authType: AuthCredentialTypes.OAUTH2, oauth2: { clientId: "your_client_id", clientSecret: "your_client_secret", }}@example:// Open ID Connect Authconst authCredential: AuthCredential = { authType: AuthCredentialTypes.OPEN_ID_CONNECT, oauth2: { clientId: "1234", clientSecret: "secret", redirectUri: "https://example.com", scopes: ["scope1", "scope2"], }}@example:// Auth with resource referenceconst authCredential: AuthCredential = { authType: AuthCredentialTypes.API_KEY, resourceRef: "projects/1234/locations/us-central1/resources/resource1"}
Optional
Resource reference for the credential. This will be supported in the future.
Data class representing an authentication credential.
To exchange for the actual credential, please use CredentialExchanger.exchangeCredential().
Example
Example
Example
Example