google.oauth2.utils module¶
OAuth 2.0 Utilities.
This module provides implementations for various OAuth 2.0 utilities. This includes OAuth error handling and Client authentication for OAuth flows.
OAuth error handling¶
This will define interfaces for handling OAuth related error responses as
stated in RFC 6749 section 5.2.
This will include a common function to convert these HTTP error responses to a
google.auth.exceptions.OAuthError
exception.
Client authentication for OAuth flows¶
We introduce an interface for defining client authentication credentials based on RFC 6749 section 2.3.1. This will expose the following capabilities:
Ability to support basic authentication via request header.
Ability to support bearer token authentication via request header.
Ability to support client ID / secret authentication via request body.
- class ClientAuthentication(client_auth_type, client_id, client_secret=None)[source]¶
Bases:
object
Defines the client authentication credentials for basic and request-body types based on https://tools.ietf.org/html/rfc6749#section-2.3.1.
Instantiates a client authentication object containing the client ID and secret credentials for basic and response-body auth.
- class OAuthClientAuthHandler(client_authentication=None)[source]¶
Bases:
object
Abstract class for handling client authentication in OAuth-based operations.
Instantiates an OAuth client authentication handler.
- Parameters:
client_authentication (
Optional
[google.oauth2.utils.ClientAuthentication
]) – The OAuth client authentication credentials if available.