Client Class
OpenID Connect is a layer on top of the OAuth2.
See its specs at https://openid.net/connect/
- Inheritance
-
Client
Constructor
Client(server_configuration, client_id, on_obtaining_tokens=<function Client.<lambda>>, on_removing_rt=<function Client.<lambda>>, on_updating_rt=<function Client.<lambda>>, **kwargs)
Parameters
- server_configuration
- client_id
- on_obtaining_tokens
- on_removing_rt
- on_updating_rt
Methods
| build_auth_request_uri |
Generate an authorization uri to be visited by resource owner. Return value and all other parameters are the same as <xref:oauth2.Client.build_auth_request_uri>, plus new parameter(s): |
| decode_id_token |
See decode_id_token. |
| initiate_auth_code_flow |
Initiate an auth code flow. It provides nonce protection automatically. See <xref:oauth2.Client.initiate_auth_code_flow> in parent class for descriptions on other parameters and return value. |
| obtain_token_by_auth_code_flow |
Validate the auth_response being redirected back, and then obtain tokens, including ID token which can be used for user sign in. Internally, it implements nonce to mitigate replay attack. It also implements PKCE to mitigate the auth code interception attack. See <xref:oauth2.Client.obtain_token_by_auth_code_flow> in parent class for descriptions on other parameters and return value. |
| obtain_token_by_authorization_code |
Get a token via authorization code. a.k.a. Authorization Code Grant. Return value and all other parameters are the same as <xref:oauth2.Client.obtain_token_by_authorization_code>, plus new parameter(s): |
| obtain_token_by_browser |
A native app can use this method to obtain token via a local browser. Internally, it implements nonce to mitigate replay attack. It also implements PKCE to mitigate the auth code interception attack. See <xref:oauth2.Client.obtain_token_by_browser> in parent class for descriptions on other parameters and return value. |
build_auth_request_uri
Generate an authorization uri to be visited by resource owner.
Return value and all other parameters are the same as <xref:oauth2.Client.build_auth_request_uri>, plus new parameter(s):
build_auth_request_uri(response_type, nonce=None, **kwargs)
Parameters
- nonce
decode_id_token
See decode_id_token.
decode_id_token(id_token, nonce=None)
Parameters
- id_token
- nonce
initiate_auth_code_flow
Initiate an auth code flow.
It provides nonce protection automatically.
See <xref:oauth2.Client.initiate_auth_code_flow> in parent class for descriptions on other parameters and return value.
initiate_auth_code_flow(scope=None, **kwargs)
Parameters
- scope
- list
A list of strings, e.g. ["profile", "email", ...]. This method will automatically send ["openid"] to the wire, although it won't modify your input list.
obtain_token_by_auth_code_flow
Validate the auth_response being redirected back, and then obtain tokens, including ID token which can be used for user sign in.
Internally, it implements nonce to mitigate replay attack. It also implements PKCE to mitigate the auth code interception attack.
See <xref:oauth2.Client.obtain_token_by_auth_code_flow> in parent class for descriptions on other parameters and return value.
obtain_token_by_auth_code_flow(auth_code_flow, auth_response, **kwargs)
Parameters
- auth_code_flow
- auth_response
obtain_token_by_authorization_code
Get a token via authorization code. a.k.a. Authorization Code Grant.
Return value and all other parameters are the same as <xref:oauth2.Client.obtain_token_by_authorization_code>, plus new parameter(s):
obtain_token_by_authorization_code(code, nonce=None, **kwargs)
Parameters
- nonce
If you provided a nonce when calling build_auth_request_uri, same nonce should also be provided here, so that we'll validate it. An exception will be raised if the nonce in id token mismatches.
- nonce
obtain_token_by_browser
A native app can use this method to obtain token via a local browser.
Internally, it implements nonce to mitigate replay attack. It also implements PKCE to mitigate the auth code interception attack.
See <xref:oauth2.Client.obtain_token_by_browser> in parent class for descriptions on other parameters and return value.
obtain_token_by_browser(display=None, prompt=None, max_age=None, ui_locales=None, id_token_hint=None, login_hint=None, acr_values=None, **kwargs)
Parameters
Feedback
Submit and view feedback for