googleapis / googleapis/google-cloud-node

Supporting non nodejs runtimes

Aperta
#7,702 0 commenti 8 reazioni 0 assegnatari Vedi su GitHub
library: google-cloud-node-core next major: breaking change size: m type: feature request
Lingua principale
TypeScript
Stelle
3.2k
Fork
713
Merge medio
2g 9h
PR unite (30g)
104

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia tracciando l’autenticazione attraverso gtoken e la sua dipendenza jws nel flusso di googleapis, usando l’esempio di Cloudflare Worker come caso di compatibilità. Il lavoro è completato quando l’autenticazione di googleapis funziona su workers, Bun, il web e altri runtime non-Node.js, senza mantenere un fork né fare affidamento su richieste HTTP grezze.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
nodejs, typescript
Ambito
authentication, backend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.