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

aries-auth

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aries-auth

The google oauth implementation no one asked for

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

aries-auth

The lightweight Google OAuth implementation no one asked for

Installation

npm i aries-auth

Usage

You need a Google Cloud app with the openid scope as a part of the OAuth credentials

import { getIdToken, verifyJWT } from 'aries-auth/server'

Use getIdToken to get an openID JWT containing the to-be logged-in user's publicly available info

/**
 * - accessCode from the initial Google API request that redirects to the auth
 *   endpoint on your server where this function is getting called
 * - clientId and clientSecret of your google app
 * - redirectUrl the path of the auth endpoint on your server
 */
const idToken = await getIdToken(accessCode, clientId, clientSecret, redirectUrl)

With that ID token, you can use verifyJWT to get the decoded payload with the user's info like their email

const userPayload = await verifyJWT(idToken, googleId)

FAQs

Package last updated on 13 Mar 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