3

Up until recently, I had a standalone web app (e.g. Add to Homescreen) successfully authenticating users with Google's OAuth. Apparently they recently made changes and are not going to allow native web-views to initiate OAuth flows. This is problematic. Of course, I had an app set up in the developer console that was authorized to do this but in my futzing around I accidentally deleted it before realizing this change had happened.

How can I use Google OAuth within a standalone web app?

Avand Amiri
  • 767
  • 7
  • 13

2 Answers2

2

my tests suggest that if you use a google client id from a project created months ago you get a warning about this only working until april 2017, and if you create a new google project you get disallowed_useragent instead. so if you had another thing you created a google project for try borrowing a client id from there...

bazik
  • 609
  • 3
  • 18
  • So are you saying that Google no longer supports OAuth (or any) authentication in iOS Standalone Web Apps? – Jordan Baker Apr 09 '17 at 19:28
  • 2
    I have just run into this myself. Adding your web app to the home screen in iOS bricks the Oauth flow. For how hard Google pushes PWA's, this seems crazy. My question, anyone know where you would open a ticket for this? Make sure Google is aware? – jrmerz Apr 18 '17 at 03:24
  • Facing same issue. Thinking now to remove Google+ login/registration on my app – Dani May 25 '17 at 10:49
  • Yep facing same issues @jrmerz. I'm currently exploring the option of using a popup window for OAuth (which opens in Mobile Safari) and then redirecting back to my webapp... – wle8300.com Jun 22 '17 at 19:07
2

In the end, I was never able to find an old project with an ID that would work. So I had to get creative. Instead of asking users to "add to homescreen" as step 1, I ask them to sign in first. Then, I take them to a page who's URL works once to sign them in (they're account is empty and my app doesn't send emails, so the security risk is nominal). The URL they end up adding to their homescreen signs them in the first time it's used.

To try it out, try signing up for While, a to-do list app, on an iPhone.

Avand Amiri
  • 767
  • 7
  • 13