New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@adntro/google-cloud-auth

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adntro/google-cloud-auth

Google Cloud auth utilitities (get token from functions, local, etc.)

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

@adntro/google-cloud-auth

Google Cloud auth utilitities (get token from functions, local, etc.)

npm version

It makes easy to get a bearer token to use from local to invoked authorized endpoints (Cloud Functions, Cloud Run, etc.), and also to get that token to invoke a secured resource from another resorce.

Getting started

Install as a dependency

npm i -S @adntro/google-cloud-auth
  • In local environment you must have installed gcloud sdk (https://cloud.google.com/sdk/docs/install)
  • From a function, the service account which executes the code should have permission to invoke the remote function

Usage

const { getIdToken } = require('@adntro/google-cloud-auth');

async function invokeEndpoint(url, data) {
    const token = await getIdToken(url);
    return fetch(url, {
        method: 'POST',
        body: JSON.stringify(data),
        headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'Authorization': 'Bearer ' + token  // <-- The idToken
        }
    });
}

License

MIT


Made with ❤️ by the Adntro Genetics Developer Team.

NOTE: This is not an official Adntro product.

Keywords

FAQs

Package last updated on 29 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc