略過時刻:當 One Tap 提示訊息因自動取消、手動取消,或 Google 無法核發憑證而關閉時,就會發生這種情況,例如當所選工作階段登出 Google 時。
在這種情況下,建議您繼續使用其他身分驗證服務供應商 (如有)。
Dismissed moment:當 Google 成功擷取憑證,或使用者想要停止憑證擷取流程時,就會觸發這個事件。舉例來說,當使用者開始在登入對話方塊中輸入使用者名稱和密碼時,您可以呼叫 google.accounts.id.cancel() 方法來關閉 One Tap 提示,並觸發已關閉的狀態。
以下程式碼範例實作略過片段:
<script> function continueWithNextIdp(notification){ if(notification.isNotDisplayed()|| notification.isSkippedMoment()){ // try Next provider if One Tap is not displayed or skipped } } </script> ... <div id="g_id_onload" data-client_id="YOUR_GOOGLE_CLIENT_ID" data-login_uri="https://your.domain/your_login_endpoint" data-moment_callback="continueWithNextIdp" </div>
[null,null,["上次更新時間:2024-11-21 (世界標準時間)。"],[[["Developers can customize the default login flow to better suit their application's needs."],["To determine whether to utilize additional identity providers, developers can monitor the prompt UI status using a callback function."],["The prompt UI status includes key moments like display, skipped, and dismissed, enabling developers to manage user login efficiently."],["When Google successfully retrieves credentials or the user stops the process (\"dismissed moment\"), avoid using other identity providers."],["The provided code example demonstrates how to handle the \"skipped moment\" and proceed with alternative login options."]]],[]]