Grant Type
Different OAuth 2.0 grant types.
AuthorizationCodeGrantType
Bases: GrantTypeBase
The Authorization Code grant type is used by confidential and public clients to exchange an authorization code for an access token. After the user returns to the client via the redirect URL, the application will get the authorization code from the URL and use it to request an access token. It is recommended that all clients use RFC 7636 Proof Key for Code Exchange extension with this flow as well to provide better security.
Note
Note that aioauth
implements RFC 7636 out-of-the-box.
See RFC 6749 section 1.3.1.
Source code in aioauth/grant_type.py
ClientCredentialsGrantType
Bases: GrantTypeBase
The Client Credentials grant type is used by clients to obtain an access token outside of the context of a user. This is typically used by clients to access resources about themselves rather than to access a user's resources. See RFC 6749 section 4.4.
Source code in aioauth/grant_type.py
GrantTypeBase
Base grant type that all other grant types inherit from.
Source code in aioauth/grant_type.py
create_token_response(request, client)
async
Creates token response to reply to client.
Source code in aioauth/grant_type.py
validate_request(request)
async
Validates the client request to ensure it is valid.
Source code in aioauth/grant_type.py
PasswordGrantType
Bases: GrantTypeBase
The Password grant type is a way to exchange a user's credentials for an access token. Because the client application has to collect the user's password and send it to the authorization server, it is not recommended that this grant be used at all anymore. See RFC 6749 section 1.3.3. The latest OAuth 2.0 Security Best Current Practice disallows the password grant entirely.
Source code in aioauth/grant_type.py
RefreshTokenGrantType
Bases: GrantTypeBase
The Refresh Token grant type is used by clients to exchange a refresh token for an access token when the access token has expired. This allows clients to continue to have a valid access token without further interaction with the user. See RFC 6749 section 1.5.
Source code in aioauth/grant_type.py
create_token_response(request, client)
async
Validate token request and create token response.