googleapis / googleapis/google-cloud-node

Supporting non nodejs runtimes

Open
#7,702 0 comments 8 reactions 0 assignees View on GitHub
library: google-cloud-node-core next major: breaking change size: m type: feature request
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

### 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

```ts
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.