Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

JWT access token is created every time you call getRequestMetadata #49

Description

@jtattermusch

It looks like the JWT access token auth implementation creates a new JWT access token every time you call getRequestMetadata, instead of reusing a token created previously (if that one is still valid and has the same authUri).

see https://github.com/google/google-auth-library-nodejs/blob/master/lib/auth/jwtaccess.js#L55

This brings two problems:
-- the auth headers will be different every time you make an RPC (issue time will differ so the access token will also be different), and HTTP/2 header compression won't be able to cache the header that is considerably larger in size than a regular OAuth2 token.
-- additional overhead signing the JWT for each request (not sure how much of an issue, but I think I can be a problem under heavy load).

The exact way of caching JWT access tokens needs some thought - it needs to correctly handle token expiration and handle access tokens for different authUris separately.

it would also be good to investigate how do JWT access token implementations in other languages (Ruby, Java, etc.) handle this, I wouldn't be too surprised if they were behaving the same as node.

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions