簡體   English   中英

Google Plus登錄的“取消”按鈕

[英]Cancel button for google plus sign-in

在Twitter中,當用戶按下“取消”按鈕時,它將重定向到以下URL:

URL/verify?denied=TOKEN

因此您可以通過URL中的denied來確定它。

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

在回調函數中,如果用戶拒絕同意對話框,則會返回錯誤代碼。

一個示例回調,它檢查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);
  };

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM