Skip to content

Conversation

@sambonner
Copy link
Contributor

My team use the Cloudflare Team's identity service to authenticate and pass JWT tokens to our apps. We've been attempting to use flask-jwt-extended to verify JWT tokens within our flask apps, but have run into a bit of a problem. There seems to be an assumption that the only token types that can be used are refresh or access tokens, but Cloudflare at least sets "type": "app" within the payload. I haven't been able to find a spec anywhere that says only access and refresh are valid, and regardless Cloudflare obviously uses a different value.

Here's a PR to alter the library to support more token types. All tests are passing, but there may be some changes that merit more thought, I'm happy to take suggestions.

…an "refresh" is "access"

Cloudflare Teams JWT auth for example, sets a token with a value of
"app".
@vimalloc
Copy link
Owner

vimalloc commented Mar 8, 2021

Nice, at a glance I like how this looks! Let me look at it closer when I have some more time tomorrow and I can get it merged and a new release cut for you 👍



def verify_token_not_blocklisted(jwt_header, jwt_data, request_type):
def verify_token_not_blocklisted(jwt_header, jwt_data):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for cleaning this up 👍

Copy link
Owner

@vimalloc vimalloc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the PR! 👍

@vimalloc vimalloc merged commit 228822d into vimalloc:master Mar 9, 2021
@vimalloc
Copy link
Owner

vimalloc commented Mar 9, 2021

Released in version 4.1.0 (https://github.com/vimalloc/flask-jwt-extended/releases/tag/4.1.0). Thanks for contributing! 👍

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

Successfully merging this pull request may close these issues.

2 participants