Oauth Callback¶
Summary¶
Classes
|
Holds the result of a single OAuth callback request. |
Functions
|
Build the OAuth2 authorization URL. |
|
Start a local HTTP server, open the browser for authorization, and wait for the callback. |
Module Contents¶
- class pyinaturalist.client.oauth_callback.CallbackResult(auth_code, auth_error) None¶
Bases:
objectHolds the result of a single OAuth callback request.
- auth_code = None¶
- auth_error = None¶
- pyinaturalist.client.oauth_callback.build_authorize_url(app_id, redirect_uri, code_challenge, state) str¶
Build the OAuth2 authorization URL.
- Parameters:
- Return type:
- Returns:
The full authorization URL to open in the user’s browser.
- pyinaturalist.client.oauth_callback.get_auth_code_via_server(authorize_url, port, timeout, state, open_url) CallbackResult¶
Start a local HTTP server, open the browser for authorization, and wait for the callback.
- Parameters:
authorize_url (
str) – The full authorization URL to open in the browser.port (
int) – Port for the local callback server.timeout (
int) – Seconds to wait for the callback.state (
str|None) – Expected state value for CSRF protection;Nonedisables the check.open_url (
Callable[[str],None] |None) – Callback to open the authorization URL. Defaults towebbrowser.open.
- Return type:
- Returns:
A
CallbackResultwithauth_codeorauth_errorset.- Raises:
.AuthenticationError – if the port is already in use.