Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-oauth2-env-vars

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-oauth2-env-vars

Generate and cache Google OAuth 2.0 tokens in .env files

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
94
decreased by-55.66%
Maintainers
1
Weekly downloads
 
Created
Source

google-oauth2-env-vars

Npm version Npm downloads MIT license PRs welcome


Helper class to generate and cache Google OAuth 2.0 tokens in .env files:

GOOGLE_OAUTH_CLIENT_ID=23...8o1jm.apps.googleusercontent.com
GOOGLE_OAUTH_CLIENT_SECRET=QL...naxL
GOOGLE_PHOTOS_TOKEN={"access_token":"ya..54c","refresh_token":"1..qq0","scope":"https://www.googleapis.com/auth/photoslibrary.readonly","token_type":"Bearer","expiry_date":1598277881619}

Usage

Download package from the NPM registry:

yarn add google-oauth2-env-vars

Generate .env vars

const GoogleOAuth2 = require("google-oauth2-env-vars")

const googleOAuth2 = new GoogleOAuth2({
  // .env token var name
  token: "GOOGLE_PHOTOS_TOKEN",
  // Authorization scope
  scope: ["https://www.googleapis.com/auth/photoslibrary.readonly"],
  // APIs to enable in Google console
  apis: ["photoslibrary.googleapis.com"],
  //
  // Optional
  //
  // Port for node server
  port: 5000, // DEFAULT
})

const envVars = await googleOAuth2.generateEnvVars()

Get Auth

const GoogleOAuth2 = require("google-oauth2-env-vars")

const googleOAuth2 = new GoogleOAuth2({
  // .env token var name
  token: "GOOGLE_PHOTOS_TOKEN",
})
const auth = await googleOAuth2.getAuth()
const {token} = await auth.getAccessToken()
const googlePhotos = new GooglePhotos(token)

Contributing

  • ⇄ Pull/Merge requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.

Keywords

FAQs

Package last updated on 19 Feb 2021

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