@kenetto/kenetto-redux-authenticator

0.0.2 • Public • Published

Kenetto-Redux-Authenticator

Usage

Install kenetto-redux-authenticator via npm.

npm install --save @kenetto/kenetto-redux-authenticator

Import the necessary components

import Auth from '@kenetto/kenetto-redux-authenticator'
import {Authenticator} from '@kenetto/kenetto-redux-authenticator'

Create the configurationAuth0 with the necessary credentials. This should come from the environment variables.

The configuration must include domain, clientID, responseType, audience, scope and returnURI

Create an instance of the Auth class, which you will use for authentication.

const auth = new Auth(configurationAuth0, configurationBaseName, configurationNameSpace)

Use the auth.isAuthenticated() to check if user is authenticated. The function returns a boolean with the result.

Use the auth.logout() method to logout. The method should receive a function which will push the next page path.

auth.logout()

Use the auth.login(redirectURI) to login and redirect to pretended web page which needs to be passes to the method as a property.

auth.login('/example')

Use auth.getProfile() to get the profile of the currently logged user.

auth.getProfile().then(profile => {
  
  ...
  
  })

Readme

Keywords

none

Package Sidebar

Install

npm i @kenetto/kenetto-redux-authenticator

Weekly Downloads

0

Version

0.0.2

License

none

Unpacked Size

6.9 kB

Total Files

3

Last publish

Collaborators

  • dmmn1992