authlib icon indicating copy to clipboard operation
authlib copied to clipboard

Documentation for client_kwargs is lacking (e.g. leeway configuration)

Open hfroot opened this issue 1 year ago • 0 comments

Describe the bug

I needed to configure leeway to be shorter than the default 60 seconds.

It took me a long time and a lot of reading the code to realize that I can pass leeway to the client_kwargs (using OAuth2 with Django, Authlib v 1.3.2):

    oauth.register(
        name="...",
        server_metadata_url=settings.MY_CONFIG,
        client_kwargs={
            "scope": "...",
            "leeway": 30
        },
    )

Error Stacks

N/A

To Reproduce

N/A

Expected behavior

I would like to see documentation on client_kwargs.

From what I understand of the code:

  • leeway is passed as a kwarg to both OAuth2Session and OAuth2Client. Along with client_id, client_secret, token_endpoint_auth_method, revocation_endpoint_auth_method, scope, state, redirect_uri, token, token_placement, update_token, leeway, default_timeout
  • OAuth2Session is given as the client class of DjangoOAuth2App
  • when this client is instantiated, it is given kwargs
  • these kwargs are generated by generate_client_kwargs

... honestly at this point I get a little lost. I would write the docs but I don't want to suggest the wrong thing. Which parameters are configurable? And are they configurable during the register method as shown above or should they be configured from settings.py?

Environment:

  • OS:
  • Python Version:
  • Authlib Version: 1.3.2

Additional context

Add any other context about the problem here.

hfroot avatar Nov 26 '24 10:11 hfroot