class documentation

OAuth 2 authorization helper. Use this for web apps. OAuth 2 has a two-step authorization process. The first step is having the user authorize your app. The second involves getting an OAuth 2 access token from Dropbox. See examples under `example/oauth <https://github.com/dropbox/dropbox-sdk-python/tree/main/ example/oauth>`_

Method __init__ Construct an instance.
Method finish Call this after the user has visited the authorize URL (see :meth:`start()`), approved your app and was redirected to your redirect URI.
Method start Starts the OAuth 2 authorization process.
Instance Variable csrf_token_session_key Undocumented
Instance Variable redirect_uri Undocumented
Instance Variable session Undocumented

Inherited from DropboxOAuth2FlowBase:

Method build_path Build the path component for an API URL.
Method build_url Build an API URL.
Instance Variable code_challenge Undocumented
Instance Variable code_verifier Undocumented
Instance Variable consumer_key Undocumented
Instance Variable consumer_secret Undocumented
Instance Variable include_granted_scopes Undocumented
Instance Variable locale Undocumented
Instance Variable requests_session Undocumented
Instance Variable scope Undocumented
Instance Variable token_access_type Undocumented
Method _finish Undocumented
Method _get_authorize_url Undocumented
Instance Variable _timeout Undocumented
def __init__(self, consumer_key, redirect_uri, session, csrf_token_session_key, consumer_secret=None, locale=None, token_access_type=None, scope=None, include_granted_scopes=None, use_pkce=False, timeout=DEFAULT_TIMEOUT, ca_certs=None): (source)

Construct an instance. :param str consumer_key: Your API app's "app key". :param str redirect_uri: The URI that the Dropbox server will redirect the user to after the user finishes authorizing your app. This URI must be HTTPS-based and pre-registered with the Dropbox servers, though localhost URIs are allowed without pre-registration and can be either HTTP or HTTPS. :param dict session: A dict-like object that represents the current user's web session (Will be used to save the CSRF token). :param str csrf_token_session_key: The key to use when storing the CSRF token in the session (For example: "dropbox-auth-csrf-token"). :param str consumer_secret: Your API app's "app secret". :param str locale: The locale of the user of your application. For example "en" or "en_US". Some API calls return localized data and error messages; this setting tells the server which locale to use. By default, the server uses "en_US". :param str token_access_type: The type of token to be requested. From the following enum: * None - creates a token with the app default (either legacy or online) * legacy - creates one long-lived token with no expiration * online - create one short-lived token with an expiration * offline - create one short-lived token with an expiration with a refresh token :param list scope: List of scopes to request in base oauth flow. If left blank, will default to all scopes for app. :param str include_granted_scopes: Which scopes to include from previous grants. From the following enum: * user - include user scopes in the grant * team - include team scopes in the grant * *Note*: If this user has never linked the app, :attr:`include_granted_scopes` must be `None` :param bool use_pkce: Whether or not to use Sha256 based PKCE :param Optional[float] timeout: Maximum duration in seconds that client will wait for any single packet from the server. After the timeout the client will give up on connection. If `None`, client will wait forever. Defaults to 100 seconds. :param str ca_cert: path to CA certificate. If left blank, default certificate location will be used

def finish(self, query_params): (source)

Call this after the user has visited the authorize URL (see :meth:`start()`), approved your app and was redirected to your redirect URI. :param dict query_params: The query parameters on the GET request to your redirect URI. :rtype: class:`OAuth2FlowResult` :raises: :class:`BadRequestException` If the redirect URL was missing parameters or if the given parameters were not valid. :raises: :class:`BadStateException` If there's no CSRF token in the session. :raises: :class:`CsrfException` If the :attr:`state` query parameter doesn't contain the CSRF token from the user's session. :raises: :class:`NotApprovedException` If the user chose not to approve your app. :raises: :class:`ProviderException` If Dropbox redirected to your redirect URI with some unexpected error identifier and error message.

def start(self, url_state=None): (source)

Starts the OAuth 2 authorization process. This function builds an "authorization URL". You should redirect your user's browser to this URL, which will give them an opportunity to grant your app access to their Dropbox account. When the user completes this process, they will be automatically redirected to the :attr:`redirect_uri` you passed in to the constructor. This function will also save a CSRF token to :attr:`session[csrf_token_session_key]` (as provided to the constructor). This CSRF token will be checked on :meth:`finish()` to prevent request forgery. :param str url_state: Any data that you would like to keep in the URL through the authorization process. This exact value will be returned to you by :meth:`finish()`. :return: The URL for a page on Dropbox's website. This page will let the user "approve" your app, which gives your app permission to access the user's Dropbox account. Tell the user to visit this URL and approve your app.

csrf_token_session_key = (source)

Undocumented

redirect_uri = (source)

Undocumented

Undocumented