aries-auth

1.0.4 • Public • Published

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)

Readme

Keywords

none

Package Sidebar

Install

npm i aries-auth

Weekly Downloads

1

Version

1.0.4

License

ISC

Unpacked Size

8.9 kB

Total Files

6

Last publish

Collaborators

  • ar-ies