小编Tyl*_*nes的帖子

为什么我的Auth0找不到我的回调路线?

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)

javascript reactjs react-router auth0 react-native

5
推荐指数
1
解决办法
368
查看次数

标签 统计

auth0 ×1

javascript ×1

react-native ×1

react-router ×1

reactjs ×1