kloudless.application - Oauth methods

kloudless.application.verify_token(app_id, token)

Verify whether the token belongs to Application with app_id.

Refer to Verify the token for more information.

Parameters:
  • app_id (str) – Application ID
  • token (str) – Account’s Bearer token
Returns:

(dict) Token information

Raise:

kloudless.exceptions.TokenVerificationFailed

kloudless.application.get_authorization_url(app_id, redirect_uri, scope='all', state='', extra_data='', **params)

Get the url to start the first leg of OAuth flow.

Refer to Authentication Docs for more information.

Parameters:
  • app_id (str) – Application ID
  • redirect_uri (str) – Redirect URI to your application server
  • scope (str) – A space-delimited string of scopes that indicate which services a user can connect, and which permissions to request
  • state (str) – An arbitrary string which would be redirected back via redirect_uri as query parameter. Random url-safe Base64 string would be generated by default
  • extra_data (str) – A URL-encoded JSON object containing data used to pre-fill default values for fields in the Kloudless authentication forms. For example, the domain of a WebDAV server
  • params – Additional query parameters
Returns:

tuple(url, state): Redirect the user to url to start authorization. Saved state in user’s session for future validation

Return type:

tuple(str, str)

kloudless.application.get_token_from_code(app_id, api_key, orig_state, orig_redirect_uri, **params)

Retrieve bearer token from authorization code.

Parameters:
Returns:

(str) Bearer token

Raise:

kloudless.exceptions.OauthFlowFailed