Preconfigured all-in-one serversΒΆ

A pre configured server is an all-in-one endpoint serving a specific class of application clients. As the individual endpoints, they depend on the use of a Request Validator.

Construction is simple, only import your validator and you are good to go:

from your_validator import your_validator
from oauthlib.oauth2 import WebApplicationServer

server = WebApplicationServer(your_validator)

If you prefer to construct tokens yourself you may pass a token generator:

def your_token_generator(request, refresh_token=False):
    return 'a_custom_token' + request.client_id

server = WebApplicationServer(your_validator, token_generator=your_token_generator)

This function is passed the request object and a boolean indicating whether to generate an access token (False) or a refresh token (True).