2014-03-03 67 views
1

在Twitter上,當用戶按下取消按鈕被重定向到這個網址:取消按鈕,谷歌加簽入

URL/verify?denied=TOKEN

因此,你可以通過在URL中denied確定它。

在google +登錄中,有沒有辦法檢測登錄頁面中的取消按鈕或者檢測到javascript或jquery的關閉按鈕?

回答

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); 
    }; 
+0

將ü能夠確定用戶按下關閉按鈕? – Bazinga