Skip to content

Validating Google OIDC ID tokens #208

@acrossen

Description

@acrossen

I'm attempting to craft an auth system for my SPA that uses Google as the auth provider, and flask-jwt to validate tokens on the client. From the Flask back-end, I make the Google ID token (which is a JWT) available to my JS front-end, which gets used in the UI as well as being sent along in an Auth header to API calls protected with @jwt_required.

I successfully integrated flask-jwt-simple to do this, but since the Extended module is more sophisticated I'd like to migrate to that for its callbacks, etc. In so doing, I'm running into a couple roadblocks. I know the extended module is more opinionated, but I wondered whether making a couple things (at least that I've discovered so far) configurable would make my use case viable:

  • Supporting audience verification like flask-jwt-simple. Google ID tokens have an audience and the simple module verifies them optionally via the JWT_DECODE_AUDIENCE config element. Not supporting audience at all causes PyJWT to fail validation when the token has an audience.
  • Making the type claim optional via a config element.

I believe this would do the trick and make the validation process configurable to resemble that of its simple counterpart.

Thoughts? Thanks for a great module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions