1.0.4 • Published 3 years ago

aries-auth v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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)
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago