@entur/auth-provider
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

@entur/auth-provider

Authentication provider for Entur applications. Primarily aimed at easing transition between legacy keycloak and auth0 in internal and data provider applications.

NPM JavaScript Style Guide

Install

npm install --save @entur/auth-provider

Usage

import React from 'react'
import { render } from 'react-dom';

import AuthProvider, { useAuth } from '@entur/auth-provider';

const auth0Config = {}; //<-- see auth0 docs for required fields
const auth0ClaimsNamespace = ''; // <-- required for custom roles parsing

// If set to false, app will not automatically redirect to login page
const loginAutomatically = false;

const App = () => {
  const {
    isAuthenticated
  } = useAuth();

  return (
    <h1>
      {isAuthenticated ? 'Yay' : 'Oh no ...'}
    </h2>
  )
}

render(
  <AuthProvider
    auth0Config={auth0Config}
    auth0ClaimsNamespace={auth0ClaimsNamespace}
    loginAutomatically={loginAutomatically}
  >
    <App />
  <AuthProvider>
);

Release

First build:

npm run build

Then bump version:

npm version [major|minor|patch]

Then publish (use dry-run first to see what's included)

npm publish --dry-run

npm publish

Finally, push tags to GitHub

git push origin --tags

License

EUPL © entur/nrp

Readme

Keywords

none

Package Sidebar

Install

npm i @entur/auth-provider

Weekly Downloads

6

Version

1.1.1

License

EUPL

Unpacked Size

23.5 kB

Total Files

13

Last publish

Collaborators

  • phun-ky
  • ceciliehrr
  • tysseng-entur
  • martinbjerkeengen
  • frankwaldal
  • carljoachim
  • oysval
  • magnusrand
  • wfeiring
  • vages
  • enturas
  • kentandersen
  • testower