1.0.6 • Published 3 years ago

@ithreat/auth-provider v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@ithreat/auth-provider

authorization provider component

NPM JavaScript Style Guide

Install

npm install --save @ithreat/auth-provider

Usage

import React, { useContext } from 'react'

import { AuthProvider, Auth0Context } from '@ithreat/auth-provider'

const App = () => {
  render() {
    return (
            <AuthProvider
              LoadingIndicator={LoadingIndicator}
              GenericError={GenericError}
              Button={Button}
              LOGIN_REDIRECT={LOGIN_REDIRECT}
              domain={Authorization_domain}
              client_id={ClientId}
              redirect_uri={window.location.origin + LOGIN_REDIRECT}
              onRedirectCallback={onRedirectCallback}
              audience={Auth_Audience}
              scope={Auth_Scope}
            >
              <App2 />
            </AuthProvider>
    )
  }
}

const App2 = () => {
    const { getTokenSilently, getIdTokenClaims, logout } = useContext(Auth0Context);
  return (
    <div>
        App 2 has access to Auth Context.
    </div>
  )
}

export default App;

License

MIT © djm-ithreat