@sean7218/auth-provider

auth0 wrapper build on React Hooks Context API

Usage no npm install needed!

<script type="module">
  import sean7218AuthProvider from 'https://cdn.skypack.dev/@sean7218/auth-provider';
</script>

README

@sean7218/auth-provider

Usage

import { createAuth0Provider } from '@sean7218/auth-provider';

const AUTH0_CONFIG = {
    domain: 'auth.auth0.com',
    clientID: 'YOUR_CLIENT_ID',
    redirectUri: "http://localhost:3001/callback",
    responseType: 'token id_token',
    scope: 'openid profile email'
}

const Auth0Provider = createAuth0Provider(AUTH0_CONFIG, "development")

ReactDOM.render(
    <Auth0Provider>
        <Router history={history}>
            <Switch>
                <Route exact path="/" component={Home}/>
                <Route path="/callback" component={Callback}/>
                <Route path="/app" component={App} />
            </Switch>
        </Router>
    </Auth0Provider>, 
document.getElementById('root'));