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

GoogleAuth ignores credentials passed to it in getClient in favor of cached credentialsΒ #390

@G-Rath

Description

@G-Rath

The getClient method in GoogleAuth will ignore any credentials passed to it if it has cached credentials, regardless of differences between the credentials passed in the parameter and the credentials that have been cached:

https://github.com/google/google-auth-library-nodejs/blob/0ff24c7c4a1c5da604dd2019dfc225a922934e3e/src/auth/googleauth.ts#L656-L675

As far as I can find, there is no way to actually clear the cached credentials once it has been set. (Aside from manually explicitly setting the property to null, which doesn't feel right to me).

I'd imagine ideally that if the credentials didn't match, the cached ones would be ignored.
I'd expect at least some way to bust the cache; possibly as a property in the options parameter (something like useCachedCredentials: boolean).

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions