Socket
Socket
Sign inDemoInstall

google-auth-simplify

Package Overview
Dependencies
33
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    google-auth-simplify

It simplifies google-auth-library in 3 steps. 1- Generate auth url, 2- Get auth token, 3- Get user info.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
3.48 MB
Created
Weekly downloads
 

Readme

Source

google-auth-simplify

It simplifies google-auth-library in 3 steps:

  1. Generate auth URL.
  2. Get auth token.
  3. Get user info.

Install

npm i google-auth-simplify

Example

const express = require('express');
const { GoogleAuth } = require('google-auth-simplify');

const app = express();

const googleAuth = new GoogleAuth({
  clientId: GOOGLE_CLIENT_ID,
  clientSecret: GOOGLE_CLIENT_SECRET,
  redirectURI: GOOGLE_REDIRECT_URI,
});

app.get('/login', (req, res) => {
  const authUrl = googleAuth.generateAuthUrl();// STEP 1
  res.redirect(authUrl);
});

app.get('/google_redirect_url', async (req, res) => {
  const code = req.query['code'];
  const authToken = await googleAuth.getAuthToken(code);// STEP 2
  const profile = await googleAuth.getUserInfo(authToken);// STEP 3
  res.json({profile});
});

app.listen(3000, () => {
  console.log('server started:.:.:');
});

Keywords

FAQs

Last updated on 20 Oct 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc