# google-cloud-edge-service-account-auth

> Google Cloud API service account auth helpers for the Edge runtime

Latest version **0.1.2** (published 2023-08-03) · LGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install google-cloud-edge-service-account-auth
pnpm add google-cloud-edge-service-account-auth
yarn add google-cloud-edge-service-account-auth
bun add google-cloud-edge-service-account-auth
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2023-08-03 |
| First published | 2023-08-03 |
| Weekly downloads | 0 |
| License | LGPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18.0.0 |
| Dependencies | 1 |
| Unpacked size | 44.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Liam Martens |
| Maintainers | liammartens |
| Keywords | google cloud, gcp, service account, edge runtime |

## Links

- npm: https://www.npmjs.com/package/google-cloud-edge-service-account-auth
- Repository: https://github.com/LiamMartens/google-cloud-edge-service-account-auth
- Issues: https://github.com/LiamMartens/google-cloud-edge-service-account-auth/issues
- npm.io page: https://npm.io/package/google-cloud-edge-service-account-auth

## Dependencies (1)

- [js-base64](https://npm.io/package/js-base64.md) ^3.7.5

## Recent versions

- 0.1.2 (latest) — 2023-08-03
- 0.1.1 — 2023-08-03
- 0.1.0 — 2023-08-03

## README

# google-cloud-edge-service-account-auth

This library was created for use in Edge Runtimes (such as Cloudflare Workers and Vercel Edge) to interact with the Google Cloud APIs using a service account JSON.

## Usage

```js
import { GoogleAuthClient } from 'google-cloud-edge-service-account-auth';

const authClient = new GoogleAuthClient(
  {
    client_email: '...',
    private_key: '...',
  },
  { fetch }
);

const { access_token } = await authClient.authenticate([
  'https://www.googleapis.com/auth/devstorage.full_control',
]);

await fetch('https://storage.googleapis.com/storage/v1/b/bucketName/o/', {
  headers: [['Authorization', `Bearer ${access_token}`]],
});
```

## Configuration Options

The 2nd constructor argument accepts a few configuration options as explained below:

| name                     | description                                                                                                                               |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `fetch`                  | Used to define the `fetch` implementation                                                                                                 |
| `authCache`              | Should implement a `GoogleAuthCache` instance (exported by the library). Can be used to cache tokens in a third party library or service. |
| `expiryThresholdSeconds` | Used to determine when to refresh tokens (defaults to `60`)                                                                               |

---
_Source: https://npm.io/package/google-cloud-edge-service-account-auth · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
