Skip to main content

OAuth2PasswordRequestForm

This is a dependency class to collect the username and password as form data for an OAuth2 password flow.

Attributes

AttributeTypeDescription
grant_type`strNone` = None
usernamestrusername string. The OAuth2 spec requires the exact field name username.
passwordstrpassword string. The OAuth2 spec requires the exact field name password.
scopeslist[str]A list of strings representing the individual scopes extracted from the space-separated scope string provided in the form data.
client_id`strNone` = None
client_secret`strNone` = None

Constructor

Signature

def OAuth2PasswordRequestForm(
grant_type: str | None = None,
username: str,
password: str,
scope: str = "",
client_id: str | None = None,
client_secret: str | None = None
) - > null

Parameters

NameTypeDescription
grant_type`strNone` = None
usernamestrThe username string required by the OAuth2 specification.
passwordstrThe password string required by the OAuth2 specification.
scopestr = ""A space-separated string of scopes which is parsed into a list of individual scope strings.
client_id`strNone` = None
client_secret`strNone` = None

Signature

def OAuth2PasswordRequestForm(
grant_type: str | None = None,
username: str,
password: str,
scope: str = "",
client_id: str | None = None,
client_secret: str | None = None
)

Parameters

NameTypeDescription
grant_type`strNone` = None
usernamestrThe user's unique identifier required by the OAuth2 specification.
passwordstrThe user's secret password string used for authentication.
scopestr = ""A space-separated string of requested access permissions to be parsed into a list of scopes.
client_id`strNone` = None
client_secret`strNone` = None