Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting non nodejs runtimes #493

Open
BjornTheProgrammer opened this issue Oct 27, 2024 · 0 comments · May be fixed by #494
Open

Supporting non nodejs runtimes #493

BjornTheProgrammer opened this issue Oct 27, 2024 · 0 comments · May be fixed by #494
Labels
size: m Pull request size is medium. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@BjornTheProgrammer
Copy link

What would you like to see in the library?

  1. Remove jws and use a different cross-runtime library, to allow for support for workers, bun, web, etc.

Describe alternatives you've considered

I've considered writing raw HTTP requests for API requests or maintaining a fork of gtoken, so that I can use jwt's with googleapis.

Additional context/notes

gtoken is how auth is maintained across all googleapis modules. Changing this would effectively allow someone to use most of googleapis with nearly any runtime.

For example, the below ran successfully in a Cloudflare worker

import { google } from 'googleapis';

const googleAuth = new google.auth.GoogleAuth({
  credentials: {
    client_email: GOOGLE_SERVICE_ACCOUNT.client_email,
    private_key: GOOGLE_SERVICE_ACCOUNT.private_key,
  },
  scopes: ["https://www.googleapis.com/auth/youtube.readonly"],
});

const youtube = google.youtube({
  auth: googleAuth,
  version: "v3",
});

const info = await youtube.channels.list({
  part: ["snippet", "contentDetails", "statistics"],
  id: [YOUTUBE_CHANNEL_ID],
});

console.log("info.data.items:", info.data.items);
"overrides": {
    "gtoken": "github:BjornTheProgrammer/node-gtoken"
  }

This would greatly broaden the ability to use the googleapis npm package, and be incredibly useful for developers. It would reduce the maintenance burden of maintaining unvetted non-standard calls to google's API via fetch requests. And significantly increase the appeal of using google's APIs.

@BjornTheProgrammer BjornTheProgrammer linked a pull request Oct 27, 2024 that will close this issue
4 tasks
@sofisl sofisl added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. size: l Pull request size is large. size: m Pull request size is medium. and removed size: l Pull request size is large. labels Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants