我正在用auth0在反應應用程序中進行LinkedIn身份驗證。我在設置中設置了回撥URL中的localhost:3000/upload
,在用戶登錄localhost:3000/login
後跳轉,他們將重定向到localhost:3000/upload
。但是,我總是得到這個錯誤:url localhost:3000/login
不在回調網址列表中。爲什麼auth0希望返回到登錄後登錄的頁面?不是它應該是一些不同的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)
}
})
}
//....
嘿,謝謝你的回答。我做了你的建議,但它仍然指引我進行身份驗證的相同網址。 –
對於反應應用程序,您應該使用隱式授予流程......所以在這種情況下,請使用responseType = token並使用事件偵聽器,因爲您的操作是我的建議。合理? – arcseldon
@shangsunset - 你解決了嗎? – arcseldon