我正在 React 应用程序中使用 auth0 进行 LinkedIn 身份验证。我在设置localhost:3000/upload中设置了回调 url,跳到用户登录后localhost:3000/login,他们将被重定向到localhost:3000/upload. 但是,我总是收到此错误:urllocalhost:3000/login不在回调 url 列表中。为什么auth0登录后会期望返回到刚才登录的页面,不应该是一些不同的url吗?这对我来说没有意义。
编辑:
export default class AuthService {
  constructor(clientId, domain) {
    // Configure Auth0
    const options = {
      allowedConnections: ['linkedin'],
      auth: {
        params: {responseType: 'code'}
      }
    };  
    this.lock = new Auth0Lock(clientId, domain, options)
    // Add callback for lock `authenticated` event
    this.lock.on('authenticated', this._doAuthentication.bind(this))
    // binds login functions to keep this context
    this.login = this.login.bind(this)
    this.loggedIn = this.loggedIn.bind(this)
  }
  _doAuthentication(authResult){
    // Saves the user token
    console.log(authResult);
    this.setToken(authResult.idToken)
    this.lock.getProfile(authResult.idToken, (error, profile) => {
      if (error) {
        console.log('Error loading the Profile', error)
      } else {
        console.log(profile)
      }
    })
  }
//....
