module documentation
Functionality to work with OAuth2 code grant
Class |
|
Metadata for Oauth2 client |
Function | exchange |
Exchange a code for an access token using the endpoints from client info |
Function | exchange |
Exchange a code for an access token using the endpoints from client info and return the entire response |
Function | get |
Build authorization url for browser |
Function | load |
Load OIDC configuration from the well known configuration endpoint |
Function | open |
Open browser using webbrowser module and show message about URL open |
def exchange_code_for_access_token(client_info:
OAuth2ClientInfo
, redirect_uri: str
, code: str
, access_token_field: str
= 'access_token') -> str
:
¶
Exchange a code for an access token using the endpoints from client info
Parameters | |
clientOAuth2ClientInfo | Info about oauth2 client |
redirectstr | Callback URL |
code:str | Code to redeem |
accessstr | Name of the field containing the access token to use. This might differ depending on the provider you are using. For example for Auth0 you have to set this to id_token |
Returns | |
str | Extracted access token from response |
def exchange_code_for_response(client_info:
OAuth2ClientInfo
, redirect_uri: str
, code: str
) -> dict
:
¶
Exchange a code for an access token using the endpoints from client info and return the entire response
Parameters | |
clientOAuth2ClientInfo | Info about oauth2 client |
redirectstr | Callback URL |
code:str | Code to redeem |
Returns | |
dict | Response from OAuth2 endpoint |
Build authorization url for browser
Parameters | |
clientOAuth2ClientInfo | Info about oauth2 client |
redirectstr | Callback URL |
Returns | |
str | Ready to use URL |