oauth2 — Provider Class

class oauth2.Provider(access_token_store, auth_code_store, client_store, token_generator, client_authentication_source=<function request_body>, response_class=<class 'oauth2.web.Response'>)[source]

Endpoint of requests to the OAuth 2.0 provider.


Adds a Grant that the provider should support.

Parameters:grant (oauth2.grant.GrantHandlerFactory) – An instance of a class that extends oauth2.grant.GrantHandlerFactory
dispatch(request, environ)[source]

Checks which Grant supports the current request and dispatches to it.

  • request (oauth2.web.Request) – The incoming request.
  • environ (dict) – Dict containing variables of the environment.

An instance of oauth2.web.Response.


Enable the use of unique access tokens on all grant types that support this option.


Sets the separator of values in the scope query parameter. Defaults to ” ” (whitespace).

The following code makes the Provider use “,” instead of ” “:

provider = Provider()
provider.scope_separator = ","

Now the scope parameter in the request of a client can look like this: scope=foo,bar.