0.0.4 • Published 3 years ago

simple-auth0 v0.0.4

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

simple-auth0

Wrapper around the auth0-js and auth0-lock libraries to provide a simple authentication package reusable across applications.

Usage

Install via npm:

npm install --save simple-auth0

Use with this trial code:

import createAuth0Client from "simple-auth0";

const auth0 = createAuth0Client({
  clientID: "",
  domain: "",
  audience: "",
  assembleUser: (profile, accessToken) => {
    return {
      name: profile.name,
      accessToken
    }
  },
  lockTheme: {
    logo: "",
    primaryColor: "#000000",
    backgroundColor: "#000000"
  },
  lockTitle: "My Application"
});

auth0
  .currentUser()
  .then(({ user }) => {
    // sample logic
    if (user) {
      // redirect to login screen
    } else {
      // start authenticated app
    }
  })