@oauth
Overview
The @oauth decorator is used to apply OAuth-based authentication to classes. It adds OAuth-specific metadata, such as endpoints, arguments, and provider details, to the class, enabling integration with OAuth services.
Syntax
@oauth(
id=str,
provider=OAuthProvider,
flows=Optional[List[OAuthFlow]] = None,
authorize_endpoint=str,
token_endpoint=str,
scopes=Optional[List[str]] = None,
)
class ClassName:
"""
Class description
"""
# Class implementationParameters
Parameter
Type
Required
Description
id
str
Yes
The unique identifier for the OAuth configuration.
provider
OAuthProvider
Yes
The OAuth provider:
OAuthProvider.MICROSOFT
OAuthProvider.GOOGLE
flows
List[OAuthFlow]
Optional
A list of OAuth flows.
authorize_endpoint
str
Yes
The authorization endpoint URL for the OAuth provider.
token_endpoint
str
Yes
The token endpoint URL for exchanging the authorization code for a token.
scopes
List[str]
Optional
A list of scopes required by the OAuth provider for the authenticated requests.
Example
Last updated
Was this helpful?
