aries-auth

v1.0.0
The google oauth wrapper no one asked for

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)

Metadata

  • ISC
  • Whatever
  • Aries
  • released 3/13/2022

Downloads

Maintainers