Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

JWT can't be verified #336

@agmezr

Description

@agmezr

I am trying to validate a JWT generated by Google IAP based on this example but it seems that verifying the token causes problems on the google.auth.jwt module

I created this token as an example using the tool in https://jwt.io::

from google.auth import jwt
token = 'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkxZeVAyZyJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.OjJokSnHIdMxqTlpT055GJDe72-zoTZBE5NISmrDPx0dletHBTnlbl1wwr0EhWaxgKIesZ7N7eLd4XW-TgX-vA'
cert = '-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEVs/o5+uQbTjL3chynL4wXgUg2R9\nq9UU8I5mEovUf86QZ7kOBIjJwqnzD1omageEHWwHdBO6B+dFabmdT9POxg==\n-----END PUBLIC KEY-----\n'
jwt.decode(token, certs=cert)

And got the following error:

/tests/jwt/google_auth/venv/lib/python3.5/site-packages/rsa/pem.py", line 92, in load_pem
    raise ValueError('No PEM start marker "%s" found' % pem_start)
ValueError: No PEM start marker "b'-----BEGIN RSA PUBLIC KEY-----'" found

It seems weird that the jwt module can't decode a token created with the EC256 algorithm since is the algorithm used by Google IAP.

Any idea of why this is happening?

Environment

  • OS: GNU/Linux
  • Python version: 3.5
  • pip version: 19.1
  • google-auth version: 1.6.3

Thanks!

Metadata

Metadata

Labels

type: questionRequest for information or clarification. Not an issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions