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.

GoogleAuth can no longer be used with googleapis: Type 'GoogleAuth<JSONClient>' is not assignable to type 'string | OAuth2Client | BaseExternalAccountClient | GoogleAuth<JSONClient> | undefined' #1402

@sceee

Description

@sceee

After updating google-auth-library-nodejs from v7.14.1 to v8.0.1, the following Typescript compile error occurs:

Type 'GoogleAuth<JSONClient>' is not assignable to type 'string | OAuth2Client | BaseExternalAccountClient | GoogleAuth<JSONClient> | undefined'.
  Type 'import(".../node_modules/google-auth-library/build/src/auth/googleauth").GoogleAuth<import(".../node_modules/google-auth-library/build/src/auth/googleauth").JSONClient>' is not assignable to type 'import(".../node_modules/google-gax/node_modules/google-auth-library/build/src/auth/googleauth").GoogleAuth<import(".../node_modules/google-gax/node_modules/google-auth-library/build/src/auth/googleauth").JSONClient>'.
    Types have separate declarations of a private property 'checkIsGCE'.

Environment details

  • OS: Windows
  • Node.js version: v16.14.2
  • npm version: v8.7.0
  • google-auth-library version: v8.0.1

Steps to reproduce

  1. Use the same code as previously
import { google } from 'googleapis'
import { GoogleAuth } from 'google-auth-library'

function setCredentials(): void {
  const client = new GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-billing', 'https://www.googleapis.com/auth/cloud-platform'],
  })

  google.options({
    auth: client, // Error is emmitted for this line after updating google-auth-library-nodejs to v8
  })
}
  1. Execute tsc for Typescript compile

Metadata

Metadata

Labels

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