Search code examples
iosgoogle-drive-apigoogle-oauthgtm-oauth2

Google API Changes causing problems on my App


I have an iOS App on the App Store, and it connects to Google Drive. In the past week or so, I've noticed two new problems in my live app.

The App suddenly stopped logging in. I would get a 401 - invalid_client. I found a lot of questions/answers for this problem, but they were all for people who couldn't get it working. Mine was working for about two years and then stopped working a couple of days ago. After trying a lot of things, I found that I was using <id>@developer.gserviceaccount.com as my Client ID, and when I changed it to <id>.apps.googleusercontent.com it worked again. I don't know why this change fixed it, and even knowing that this fixes it, I can't find if this is the correct/appropriate solution.

I explain my second problem, which is very specific here, but skip to the next paragraph to get to the point. The second issue is a a result of Google changing the way their API calls respond, and this is why this wasn't an issue when we submitted the latest version of the App to the App Store. Google has changed the way the explicitlyTrashed property of their GTLDriveFile class. Per their spec, this property should be either an NSNumber containing Yes, or null. They have recently changed it so that it is always an NSNumber set to either Yes or No. This is what's breaking our functionality.

Anyway, these are two changes Google has made on their end recently that currently has my customers on hold since I have to fix this and push it out. My question is if there's a place to keep up with these changes that Google is making recently. Also, if someone knows or can point me to why the first issue is happening, I would greatly appreciate it.


Solution

  • For the first issue, the reason why it got resolved by using [id].apps.googleusercontext.com is because it it requesting an authorization token from an app to the server, as opposed to a Server to Server transaction using impersonation ([id]@developer.gserviceaccount.com). This is the right solution for both android and IOS apps requesting a token.

    As for your second question, the best way to keep up to date with the latest changes is through their official blog: http://googleappsdeveloper.blogspot.com/

    Another resource is the G+ Google Drive Developer community: https://plus.google.com/communities/107264319205603895037