An authentication credential, in one of several shapes selected by authType.
authType
To turn one of these into the credential a request actually carries, use the exchange() method of a BaseCredentialExchanger.
exchange()
// 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", }} Copy
// OAuth2 Auth with Authorization Code Flowconst authCredential: AuthCredential = { authType: AuthCredentialTypes.OAUTH2, oauth2: { clientId: "your_client_id", clientSecret: "your_client_secret", }}
// Open ID Connect Authconst authCredential: AuthCredential = { authType: AuthCredentialTypes.OPEN_ID_CONNECT, oauth2: { clientId: "1234", clientSecret: "secret", redirectUri: "https://example.com", }} Copy
// Open ID Connect Authconst authCredential: AuthCredential = { authType: AuthCredentialTypes.OPEN_ID_CONNECT, oauth2: { clientId: "1234", clientSecret: "secret", redirectUri: "https://example.com", }}
// Auth with resource referenceconst authCredential: AuthCredential = { authType: AuthCredentialTypes.API_KEY, resourceRef: "projects/1234/locations/us-central1/resources/resource1"} Copy
// 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.
An authentication credential, in one of several shapes selected by
authType.To turn one of these into the credential a request actually carries, use the
exchange()method of a BaseCredentialExchanger.Example
Example
Example
Example
Example
Example