Skip to content

New token for every request #260

Answered by prkumar
jrvc1919 asked this question in Q&A
Feb 23, 2022 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Hey!

One option is to use the Header argument annotation.

If you need to prepend "Bearer" to the token returned by get_jwt, you could wrap the call. For example:

class MyConsumer(Consumer):

    def get_user(self):
        return self._get_user(f"Bearer {get_jwt()}")

    @get("user")
    def _get_user(self, token: Header("Authorization")):
        pass

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@jrvc1919
Comment options

@prkumar
Comment options

@jrvc1919
Comment options

@prkumar
Comment options

Answer selected by jrvc1919
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants