Skip to main content
Version: 1.0

oauth2_auth

File: core/src/utcp/data/auth_implementations/oauth2_auth.py

class OAuth2Auth (Auth)

Documentation

Authentication using OAuth2 client credentials flow.

Implements the OAuth2 client credentials grant type for machine-to-machine authentication. The client automatically handles token acquisition and refresh.

Attributes

  • auth_type: The authentication type identifier, always "oauth2".
  • token_url: The URL endpoint to fetch the OAuth2 access token from. Recommended to use injected variables.
  • client_id: The OAuth2 client identifier. Recommended to use injected variables.
  • client_secret: The OAuth2 client secret. Recommended to use injected variables.
  • scope: Optional scope parameter to limit the access token's permissions.

Fields:

  • auth_type: Literal['oauth2']
  • token_url: str
  • client_id: str
  • client_secret: str
  • scope: Optional[str]

class OAuth2AuthSerializer (Serializer[OAuth2Auth])

No class documentation available

Methods:

to_dict(self, obj: OAuth2Auth) -> dict

Convert an OAuth2Auth object to a dictionary.

Args

  • obj: The OAuth2Auth object to convert.

Returns

The dictionary converted from the OAuth2Auth object.

validate_dict(self, obj: dict) -> OAuth2Auth

Validate a dictionary and convert it to an OAuth2Auth object.

Args

  • obj: The dictionary to validate and convert.

Returns

The OAuth2Auth object converted from the dictionary.