Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google API fails to authenticate when iOS client ID is used

I'm trying to integrate the Google Data API into my application. I'm using the ObjC wrapper available here:

http://code.google.com/p/gdata-objectivec-client

but I have got some issues with the authentication. Basically I'm following the steps as described here:

http://code.google.com/p/gtm-oauth2/wiki/Introduction#Signing_In_to_Google_Services

I have created a project on the API Console and added two client IDs for installed applications: one is of the "Other" platform, the other is "iOS" with the bundle ID appropriately set (though I left the appstore id 0 for the moment). Now comes the interesting part.

Both the YouTubeSample app bundled with the above wrapper library AND my iOS app work perfectly with the client ID belonging to the "Other" platform, and both of them return a 400 invalid_client error when I switch the ID for the iOS one. I have doublechecked the client IDs and secrets, all are correct. The iOS app has of course been given the correct bundle ID.

So, am I missing something trivial here?

like image 642
Lvsti Avatar asked Nov 13 '22 02:11

Lvsti


1 Answers

Is there a reason that you need to use the iOS-type id/secret pair instead of the other-type pair? Perhaps I'm missing something, but the linked documentation states to not use an iOS type client id:

In the console, create a project, then click "API Access" in the left column. Create a new Client ID for an Installed Application (not a web application) type other (not iOS). This will provide Client ID and Secret strings to be used with the controller.

The controller likely doesn't identify itself as an iOS application when sending the requests, which Google probably checks when it receives an iOS id/secret pair.

like image 159
Prata Avatar answered Dec 23 '22 06:12

Prata