Skip to content
Permalink
Browse files

Wrap application in Auth0Provider and use Auth0 config

  • Loading branch information
ivarprudnikov committed Jan 2, 2020
1 parent 6a9b725 commit 710f0bb9760b9f74e6474ae4cc5181672d3f0c7b
Showing with 24 additions and 1 deletion.
  1. +24 −1 src/index.js
@@ -3,8 +3,31 @@ import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { Auth0Provider } from "./react-auth0-spa";
import config from "./auth_config.json";
import history from "./utils/history";

ReactDOM.render(<App />, document.getElementById('root'));
// A function that routes the user to the right place
// after login
const onRedirectCallback = appState => {
history.push(
appState && appState.targetUrl
? appState.targetUrl
: window.location.pathname
);
};

ReactDOM.render(
<Auth0Provider
domain={config.domain}
client_id={config.clientId}
redirect_uri={window.location.origin}
onRedirectCallback={onRedirectCallback}
>
<App />
</Auth0Provider>,
document.getElementById("root")
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.

0 comments on commit 710f0bb

Please sign in to comment.
You can’t perform that action at this time.