Auth0重定向到http:// localhost:3000/callback#/ acccess-token = dxy
我的反应应用程序中出现了一个空白屏幕.
继承人我的主要app.js
render((
<HashRouter>
<Main />
</HashRouter>
), $('#app')[0]);Run Code Online (Sandbox Code Playgroud)
我的主要包含我的routes.js组件.
class Routes extends Component {
constructor(props, context) {
super(props, context);
this.state = { mainData: this.props.mainData };
this.handleAuthentication = this.handleAuthentication.bind(this)
}
componentWillReceiveProps(newProps) {
this.setState((previousState) => update(previousState, {
mainData: { $set: newProps.mainData },
}));
}
handleAuthentication(nextState, replace) {
if (/access_token|id_token|error/.test(nextState.location.hash)) {
this.props.auth.handleAuthentication();
}
}
render() {
return (
<div>
<Switch>
<Route path='/callback' render={props => {
this.handleAuthentication(props);
return <Callback {...props} />
}} />
<Route exact path='/' render={props …Run Code Online (Sandbox Code Playgroud)