Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Sign-In JavaScript client not working on PWA App #473

Closed
mbellezi opened this issue Oct 8, 2018 · 35 comments
Closed

Google Sign-In JavaScript client not working on PWA App #473

mbellezi opened this issue Oct 8, 2018 · 35 comments

Comments

@mbellezi
Copy link

mbellezi commented Oct 8, 2018

Greetings,

Since yesterday when I use the gapi.auth2 to do a Google Sign-in on an installed PWA app on Android, the App opens the browser window to select the user, but it remains blank.
The same page on the Chrome browser on Android open the user selection as usual. The code is the same, from the same server. The code was not modified in more than 15 days. I presume the problem is some change in the gapi JS client code from Google servers.
Inspecting the PWA Google Sign-in tab on chrome show the following error:

Uncaught Failed to get parent origin from URL hash!

Anyone has any clue how to solve this?

@sachinrekhi
Copy link

I also just started experiencing this issue about a day ago in my Electron app. User clicks the Sign-In with Google button within my Electron app (which is just a light-weight wrapper around a website), a pop-up window appears, but the window is blank instead of showing the typical Google login options.

The following error is shown in the console in the pop-up window:

Uncaught Failed to get parent origin from URL hash!
4188232449-v2-idpiframe.js:136

When I Sign-In with Google directly from our website in Chrome, it works fine. So seems like an issue potentially with an interaction with Electron.

Everything was working fine for months and this issue just started occurring about a day or so ago. So seems like a change might have been made on the Google side.

A few other people have also run into this issue on Stack Overflow in the last day: https://stackoverflow.com/questions/52713993/google-sign-in-api-hang-with-uncaught-error-failed-to-get-parent-origin-from-url?noredirect=1&lq=1

@frankljbe
Copy link

We're seeing a similar issue in our iOS and Android application which are web view wrappers around a website. When the user clicks the button we trigger native auth. Until Monday at about 11:30 am PST. Now when the user attempts to login they are redirected to a blank screen. We didn't make any code or configuration changes the correspond with the failures.

@BHSPitMonkey
Copy link

Affecting us too, for the last day or so. It seems like if you click the sign in button again, while the blank popup is still open from your last attempt, then it goes through (the popup navigates to the correct URL). But every time I click the sign in button without the popup already open, it just opens the blank popup containing the console error.

@sachinrekhi
Copy link

@BHSPitMonkey are you experiencing the issue in an Electron app, mobile web view, or something else?

@beaukinstler
Copy link

beaukinstler commented Oct 11, 2018

also noticed it started happening on plain old flask web app I had built a few months ago. It was working yesterday one moment, then the next, it just stopped. I had been about to test moving it to a new server, so I had been actively testing on the original. I haven't seen the workaround @BHSPitMonkey just mentioned work on any linux desktop browsers, with my primary user. I tried it on iOS chrome, and it worked first with my primary gmail.com email address user, then I tried my Google Apps user, and it hung at "Sending login request to Google...". , (but that could be more a coding error on my part, having to do with setting up new users if they don't exist. It's been a while since I made this app, and I thought that had been working, by maybe not)

If I retry with my primary gmail user, it still works after that on both iOS browswers. Still not able to get it to work on Linux Ubuntu 16.04 Google Chrome, however.

I also get the "Uncaught Failed to get parent origin from URL hash!"

EDIT: After clearing cookies, i was able to get my primary Gmail user working. Still no luck on new users, but I'm guessing there's a problem on my end.

@BHSPitMonkey
Copy link

I'm seeing this with a standard web site in Chrome 69.

@beaukinstler
Copy link

beaukinstler commented Oct 11, 2018

As it might be easier for me, since I'm not dealing with anything in real production, I tried changing the client secrets, resetting the secret. That didn't change anything for me. I've also updated my domain ownership, as that wasn't done yet. Still the same problems. My app is now letting me log in, but it's supposed to also register new accounts in the DB when they don't exist, which isn't happening. Again, I suspect that's my fault, but I'll report back if I find otherwise.

@beaukinstler
Copy link

beaukinstler commented Oct 11, 2018

my issue was related to some users not having a 'name' key come back from google. I'm not sure it has to do with scopes, or if it's even a new thing. I wonder if the recent Google+ problems sparked something about authorizations to access that key. I changed my logic to derive a name from the email address instead, and all is well for me.

@sachinrekhi
Copy link

@grant any chance you could help bring this to the attention of the right folks at Google? This appears to be a regression introduced a few days ago causing Google sign-in to now fail in a variety of settings.

@grant
Copy link
Contributor

grant commented Oct 11, 2018

@bochunz Is there a recent gapi client change causing the above error?

@BHSPitMonkey
Copy link

It's hard to tell if the offending change is in the gapi client or on the server, but there was definitely a regression this week. It's still happening to me, but it's sporadic.

@boris-hocde
Copy link

Same issue on the example of https://developers.google.com/identity/sign-in/web/sign-in
Click on "Sign in" white button, in the middle of the page

When the Chrome dev tools is open, the popup is correctly loaded.
No issue when using ux_mode = redirect instead of popup.

https://drive.google.com/open?id=1Qfv_aziyunwo0T7hi4rIPAl28RDH1-WE

@potiuper
Copy link

Clicking on the "Sign in" button on the sign-in developer page works in Chromium, but not Firefox. Firefox returns the "uncaught exception: Failed to get parent origin from URL hash!" error.

@mike-seekwell
Copy link

Building on @boris-hocde , this has "fixed" the issue for me, although I had to change several other things to make it work.

      auth2 = gapi.auth2.init({
      client_id: '123.apps.googleusercontent.com',
      scope: 'profile email',
      ux_mode: 'redirect',
      redirect_uri: 'https://www.abc.io/google_login_redirect'
    })

@mike-seekwell
Copy link

mike-seekwell commented Oct 14, 2018

@grant I second @sachinrekhi , we currently only offering sign in to our desktop app thru Google OAuth, so this issue is effectively shutting us down.

@mbellezi
Copy link
Author

mbellezi commented Oct 15, 2018 via email

@mike-seekwell
Copy link

Agreed, I just had to spend all weekend programming a workaround because we have no idea when it will be fixed.

@sachinrekhi
Copy link

@bochunz Were you able to determine if there was a recent client or server change that is causing this regression in Google login?

@adamazad
Copy link

I switched from popup to redirect to overcome this issue. My app relays on the id_token for exchanging it with a custom token from server. Surpringly, the id_token from redirect doesn't return the fields name and picture.

@grant
Copy link
Contributor

grant commented Oct 15, 2018

I pinged an engineer at Google who made recent changes to gapi. I'll update here.

@mike-seekwell
Copy link

@grant Can they roll the changes back while they figure it out?

@yzhou88
Copy link

yzhou88 commented Oct 16, 2018

Wow, I spent hours on this issue. I really want this bug to be fix asap.

@sacha-senchuk
Copy link

I pinged an engineer at Google who made recent changes to gapi. I'll update here.

Thank you! I hope this will be fixed soon. Also breaks our SSO for Google users.

@mike-seekwell
Copy link

@grant Any update here? Can they please just roll the change back until they figure out what's wrong.

@aabuhijleh
Copy link

@sachinrekhi I've managed to get it working on Electron by setting webPreferences.nativeWindowOpen to true on the pop-up's parent BrowserWindow.

Now it works as well as it's working on the website using Chrome.

@mbellezi
Copy link
Author

@sachinrekhi , in my case, I don't think i can use this solution. Anyone knows if there is a similar approach for the native Android PWA launcher?

@rahulswimmer
Copy link

I have an angular 6 + PWA app that is consuming google login. I have implemented it using https://www.npmjs.com/package/angular-6-social-login.

I have started facing the same issue where pop goes blank and url is accounts.google.com/o/oauth2/iframe. In browser, this works just fine. I noticed that in browser when the google pop up appears, client id is being passed in it and when opened as a PWA, client id is not being passed and hence url for pop is not constructed. That might be one of the reason.

I don't see this as a node package issue. I request Google to resolve this issue at the earliest.

Also since i am using this package for google login, i cannot change popup to redirecturi. Hence i need a workaround in angular 6. Please suggest if any.
@adamazad can you suggest a workaround in angular 6 using the package i have used?
Thank You!

@kongguibin
Copy link

The change that caused this issue has been rolled back. Can you guys verify if GSI works on PWA now?

@grant
Copy link
Contributor

grant commented Oct 17, 2018

Hi all,
The gapi team told me that this issue should be fixed, tested on iOS.
Can you please test on your environments and verify the fix?

@sachinrekhi
Copy link

Awesome! Just verified that Google login once again works again in my Electron app.

@mbellezi
Copy link
Author

mbellezi commented Oct 18, 2018 via email

@wima75
Copy link

wima75 commented Oct 18, 2018

yes, now it works again. Thank you for fixing that.

@vivek9716
Copy link

yes, now it is working thanks.

@kevglass
Copy link

Sadly this appears to be broken again on iOS 13.4.1

@gordomo
Copy link

gordomo commented Aug 20, 2020

Hello there!
I'm working on a PWA, so, I was trying the PWA ios Wrapper (https://github.com/xtools-at/iOS-PWA-Wrapper)
The problem is that the Wrapped apps launch a popup windows (the google login one, but never finish load), and, the real google login pop up freeze after the user get logged in.(this when the user click on the google login button)

Maybe is related to this issue... can't tell... If anyone hears something please let me know!
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests