Content-Length: 275070 | pFad | http://github.com/googleapis/google-api-nodejs-client/issues/3675

5F 'OAuth2Client' is missing the following properties from type 'OAuth2Client': fetch, addUserProjectAndAuthHeaders · Issue #3675 · googleapis/google-api-nodejs-client · GitHub
Skip to content

'OAuth2Client' is missing the following properties from type 'OAuth2Client': fetch, addUserProjectAndAuthHeaders #3675

Open
@punkpeye

Description

@punkpeye

Please make sure you have searched for information in the following guides.

A screenshot that you have tested with "Try this API".

Appears like the latest version of googleapis is incompatible with google-auth-library.

A step-by-step description of how to reproduce the issue, based on the linked reproduction.

const oauth2Client = new OAuth2Client(
  config.GOOGLE_OAUTH2_CLIENT_ID,
  config.GOOGLE_OAUTH2_CLIENT_SECRET,
  pathToAbsoluteUrl(getPath('/oauth/google/callback')),
);

const result = await oauth2Client.getToken(code);

const tokens = result.tokens;

oauth2Client.setCredentials({
  access_token: tokens.access_token,
});

const oauth2 = google.oauth2({
  auth: oauth2Client,
  version: 'v2',
});

A clear and concise description of what the bug is, and what you expected to happen.

The above code sample is giving:

No overload matches this call.
  Overload 1 of 2, '(version: "v2"): Oauth2', gave the following error.
    Argument of type '{ auth: OAuth2Client; version: string; }' is not assignable to parameter of type '"v2"'.
  Overload 2 of 2, '(options: Options): Oauth2', gave the following error.
    Type 'OAuth2Client' is not assignable to type 'string | GoogleAuth<AuthClient> | OAuth2Client | BaseExternalAccountClient | undefined'.
      Type 'OAuth2Client' is missing the following properties from type 'OAuth2Client': fetch, addUserProjectAndAuthHeadersts(2769)

A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **

Because it worked prior to the latest upgrade and it is not described as a breaking change in the changelog.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/googleapis/google-api-nodejs-client/issues/3675

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy