在Twitter中,当用户按下取消按钮时,它会被重定向到此URL:
URL/verify?denied=TOKEN
因此,您可以通过网址中的denied
来确定它。
在google +登录中,有没有办法检测登录页面中的取消按钮或检测javascript或jquery的关闭按钮?
答案 0 :(得分:1)
在回调函数中,如果用户拒绝同意对话框,则会返回错误代码。
检查access_denied的示例回调,表示用户拒绝了同意对话框:
function onSignInCallback(authResult) {
if (authResult['access_token']) {
// success
} else if (authResult['error']) {
if (authResult['error'] == 'immediate_failed'){
// This is perfectly normal, the user reached the site and was not logged in
// However, if the user should be signed in on this page, it would be
// appropriate to have an error here
}
if (authResult['error'] == 'access_denied'){
// The user cancelled out of the dialog.
}
// There was an error, which means the user is not signed in.
// As an example, you can handle by writing to the console:
console.log('There was an error: ' + authResult['error']);
}
console.log('authResult', authResult);
};