class documentation

class DropboxOAuth2FlowNoRedirect(DropboxOAuth2FlowBase): (source)

View In Hierarchy

OAuth 2 authorization helper for apps that can't provide a redirect URI (such as the command-line example apps). See examples under `example/oauth <https://github.com/dropbox/dropbox-sdk-python/tree/main/ example/oauth>`_

Method __init__ Construct an instance.
Method finish If the user approves your app, they will be presented with an "authorization code". Have the user copy/paste that authorization code into your app and then call this method to get an access token.
Method start Starts the OAuth 2 authorization process.

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, 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 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, include_granted_scopes must be None :param bool use_pkce: Whether or not to use Sha256 based PKCE. PKCE should be only use on client apps which doesn't call your server. It is less secure than non-PKCE flow but can be used if you are unable to safely retrieve your app secret. :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, code): (source)

If the user approves your app, they will be presented with an "authorization code". Have the user copy/paste that authorization code into your app and then call this method to get an access token. :param str code: The authorization code shown to the user when they approved your app. :rtype: :class:`OAuth2FlowNoRedirectResult` :raises: The same exceptions as :meth:`DropboxOAuth2Flow.finish()`.

def start(self): (source)

Starts the OAuth 2 authorization process. :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.