Close httplib2 connections.
finalize(authProvider, body=None, x__xgafv=None)
Finalizes the credentials after a successful consent flow.
retrieve(authProvider, body=None, x__xgafv=None)
Retrieves authorization credentials for an authprovider, or indicates what action needs to be taken to obtain credentials. If the `token` field in the response is populated, credential retrieval was successful. If one of the fields in the `status` oneof is populated, further action is required to obtain credentials, such as redirecting the user for consent. View comments on `RetrieveCredentialsResponse` for more information.
close()
Close httplib2 connections.
finalize(authProvider, body=None, x__xgafv=None)
Finalizes the credentials after a successful consent flow.
Args:
authProvider: string, Required. The resource name of the AuthProvider. Format: `projects/{project}/locations/{location}/authProviders/{auth_provider}` (required)
body: object, The request body.
The object takes the form of:
{ # Request message for FinalizeCredentials.
"consentNonce": "A String", # Required. The same consent_nonce value that was provided during redirect in the UriConsentRequired metadata.
"userId": "A String", # Required. The identity of the end user.
"userIdValidationState": "A String", # Required. The encrypted state passed back from the consent flow.
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Response message for FinalizeCredentials. Intentionally empty
}
retrieve(authProvider, body=None, x__xgafv=None)
Retrieves authorization credentials for an authprovider, or indicates what action needs to be taken to obtain credentials. If the `token` field in the response is populated, credential retrieval was successful. If one of the fields in the `status` oneof is populated, further action is required to obtain credentials, such as redirecting the user for consent. View comments on `RetrieveCredentialsResponse` for more information.
Args:
authProvider: string, Required. The parent resource name of the AuthProvider. Format: `projects/{project}/locations/{location}/authProviders/{auth_provider}` (required)
body: object, The request body.
The object takes the form of:
{ # Request message for RetrieveCredentials.
"continueUri": "A String", # Optional. The URI to redirect the user to after consent is completed. This field is required for authproviders using the 3-legged OAuth flow. For other authprovider types, this field is unused but not rejected.
"forceRefreshToken": "A String", # Optional. Input only. Set this field only if the previous token was expired or invalid. This value must be the full, previously returned token string. Will trigger a refresh of the access token with a stored refresh token, if possible, or a new consent flow.
"scopes": [ # Optional. The OAuth scopes required for this access.
"A String",
],
"userId": "A String", # Required. The identity of the end user.
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Response message for RetrieveCredentials. Contains the access tokens and related artifacts.
"consentRejected": { # Indicates the user has rejected the permission delegation or cancelled the request. # Message indicating consent was rejected.
},
"pending": { # Indicates that the credential retrieval is pending. The caller should retry the RetrieveCredentials request after some time. # Message indicating credential retrieval is pending.
},
"success": { # Message indicating successful retrieval of credentials. # Message indicating credentials were successfully retrieved.
"expireTime": "A String", # The expiration time of the token. This does not guarantee that the token will be valid until this time, since the token could be revoked earlier. There could also be clock skew between the auth provider and the client so it may expire slightly earlier. If not set, the token might be permanent or it may be that the service does not (or cannot) know when it will expire.
"header": "A String", # The HTTP header name where the token should be placed.
"scopes": [ # The scopes actually associated with the retrieved token. End users may have rejected some requested scopes, or the third-party authorization servers can return a different set of scopes than what was asked for. Callers should verify that all required scopes for their intended use are included in this list.
"A String",
],
"token": "A String", # The retrieved access token or credential for the end user. On MCPTool call, for an invalid token OAuth spec says this should return 401 or 403, but MCPServers may implement this differently. If you get any flavor of `PERMISSION_DENIED`, retry your original request to RetrieveCredentials with force_refresh_token set to the expired/invalid token string, which will fetch a new token or initiate a new consent flow.
},
"uriConsentRequired": { # Indicates that the user must visit the provided URI to consent to delegate permission to the agent to act on their behalf. The caller can either poll the `RetrieveCredentials` method, or await the /ValidateUserId callback # Message indicating uri based consent is required.
"authorizationUri": "A String", # Output only. The URL where the user should be redirected to grant consent. This will always be present.
"consentNonce": "A String", # Output only. A one-time, randomly generated value that validates the entire consent flow is handled by a single user, avoiding CSRF attacks. It must be submitted with the FinalizeCredentials request to complete the OAuth exchange. This will always be present. Implemented per https://www.rfc-editor.org/rfc/rfc6819#section-5.3.5
"uid": "A String", # Output only. The unique ID of the credentials retrieval operation.
},
}