npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

google-credentials-helper

v0.0.10

Published

nodejs library to help with GOOGLE_APPLICATION_CREDENTIALS on Heroku and clouds other then google

Readme

Google Credentials Helper

nodejs library to help with GOOGLE_APPLICATION_CREDENTIALS on Heroku and clouds other then google

Why I created this library: TLDR;

Initially I wrote this library for myself and later I decided to open it for others, when I tried to use google apis in my nodejs server there was no way to pass the credentials directly as we can so in rest pai calls (it turned out there was a way before to pass config in client library initialization but later on it was pronounced deprecated) Google forced us to put the path of their service_account.json file in environment variable insted of the the service account json itself which I donot understand and lots of other people complaining about that. in local machine it worked fine I saved service account json in a folder and saved its path in env vars but when it came to deploy on heroku it was a real problem, because my github repo was public and I was not willing to add service account json in the repo even if it was private because you never know at that point I googled what other people doing for this problem, and I found this article in which the guy created a heroku buildpack to get service account data from env vars and create a json file on the root of the project on heroku this approach is pretty obvious and I used his buildpack at that time but later I realised that this approach will not work on other platforms if someday I migrate to someother cloud provider probably aws, I will endup at the same place as before because heroku buildpack is not going to work anywhere else but only on heroku. so I wrote this library which will do the same thing what they are doing with buildpack but through npm library so it will work anywhere without any change is codebase

Installation:

npm i google-credentials-helper

or

npm i https://github.com/malikasinger1/google-credentials-helper

Usage:

Setting Environment Variables:

In local machine You must have to have Environment variable like this:

export GOOGLE_APPLICATION_CREDENTIALS="google-credentials.json"

export GOOGLE_CREDENTIALS='{
  "type": "service_account",
  "project_id": "abc-project-id",
  "private_key_id": "6153365dad9d1...84b54867896b20a",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvg...ERNeAoD\n-----END PRIVATE KEY-----\n",
  "client_email": "dialogflow-client-service-acco@abc-project-id.iam.gserviceaccount.com",
  "client_id": "11121892...183973207",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/dialogflow-client-service-acco%40abc-project-id.iam.gserviceaccount.com"
}'

In heroku it should look like this: image

ES6 code

import gcHelper from "google-credentials-helper"

gcHelper();

ES5 code

const gcHelper = require("google-credentials-helper")

gcHelper();

Example Project:

to see this library in action, checkout this project:

Dialogflow Integration with React App

in this example project check server.mjs file on the root of the project to see how the library is imported and initialized, line# 4 and line# 7 respectively

Feedback

please feel free to contact me on [email protected] or create an issue to improve this library pull requests are always welcomed

Thanks, Malik.