Re: An actual working sample code for OAuth 2.0 for iOS

2,562 views
Skip to first unread message

Greg Robbins

unread,
Nov 8, 2012, 7:50:11 PM11/8/12
to gtm-o...@googlegroups.com
The invalid client error typically indicates a registration problem in the API console, https://code.google.com/apis/console

The client needs to be registered on the API console in the API Access section as an installed application type "Other" (not iOS), and the project must have the services required by the app enabled in the dashboard's Services section.

Christian Hansen

unread,
Nov 8, 2012, 8:43:10 PM11/8/12
to gtm-o...@googlegroups.com
Thank you for the reply. I found that i had set my app to "iOS" though it was an iOS project ... but when switched to "Other" it worked. I have added a trimmed down code base that other users can use here:


Christian


On Friday, November 9, 2012 1:21:27 AM UTC+1, Christian Hansen wrote:
Hi 

Does anyone have a working sample code for authenticating with Google API's? Something I can drop it into my project, change CliendID and secret and get an accesstoken of the user has authenticated.

I need to access Gmail API (profile, contacts, read email) I have registered my application got my Key and Secret but can't find OAuth code that actually works (and I've tried a lot). The sample code (from here: http://code.google.com/p/gtm-oauth2/source/checkout) called "OAuth2SampleTouch" fails with an error:

Error Error Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be completed. (com.google.HTTPStatus error 400.)" UserInfo=0x7108be0 {data=<7b0a2020 22657272 6f722220 3a202269 6e76616c 69645f63 6c69656e 74220a7d>}

Error data:

{

    error = "invalid_client";

}

Would really appreciate any help.

Greg Robbins

unread,
Feb 9, 2013, 6:55:52 PM2/9/13
to gtm-o...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages