Google Identity Services · ux_mode: "popup" · login_uri fallback
GSI's HTML/JS API accepts both a JS callback and a login_uri at the same
time. With ux_mode: 'popup', GSI opens the Google account chooser in a popup/iframe and,
once the user picks an account, transforms that interaction into a direct call to
your JS callback with a signed ID token — no page navigation happens on your site.
login_uri is required by GSI as a fallback target it will POST the credential to
(as a real form submission) only if JavaScript/popups are unavailable. That fallback page is
google-login-redirect.html in this repo. On a static test
site like this one there's no server to read that POST, so real logins always go through the
popup + callback path below.
When this page runs inside a native Android/iOS WebView, the native app can perform its own native
Google Sign-In and hand the result straight to this page instead of going through the web popup
above — call window.handleNativeGoogleLogin(jwt) directly, e.g. from Android with
webview.loadUrl("javascript:handleNativeGoogleLogin('" + jwt + "')") or from iOS with
webView.evaluateJavaScript("handleNativeGoogleLogin('\(jwt)')"). It accepts a raw ID
token JWT string, a JSON string, or an object containing a credential /
idToken / id_token / jwt / token field, decodes
it, and renders the same profile UI as the popup flow.
No token yet.