我正在使用Auth0在React应用程序中进行LinkedIn身份验证。我已在设置中的回调URL中设置了
localhost:3000/upload
,期望用户在localhost:3000/login
登录后将被重定向到localhost:3000/upload
。然而,我总是得到这个错误:url localhost: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)
}
})
}
//....