Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using AuthJWT for token creation only? #75

Open
vaizki opened this issue Feb 14, 2022 · 1 comment
Open

Using AuthJWT for token creation only? #75

vaizki opened this issue Feb 14, 2022 · 1 comment

Comments

@vaizki
Copy link

vaizki commented Feb 14, 2022

I have an OAuth2 password flow authorization endpoint which is used to create a token. However if I inject AuthJWT as a dependency, the request will fail as there is an Authorization: Basic <basicauth in base64> header in the request, containing client_id and client_secret.

I would still like to use the utility functions create_access_token etc. So currently I just derive a dummy class like this:

class DummyAuthJWT(AuthJWT):
    def __init__(self, req = None, res = None):
        pass

.. and inject that so that I don't get the header verification exception.

Is there a cleaner way to access the token creation only?

@Midnighter
Copy link

I have a similar need. I would like to generate tokens for an API service using a command line tool. So neither a request nor response will ever exist. Will try it with such a wrapper class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants