12

Hey I have just downloaded and built the youtube sample project from http://code.google.com/p/gdata-objectivec-client/source/checkout The application builds fine and I have entered the client id and secret. Then when I log in with my youtube account and click the "allow" button I get this error

Error Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be completed. (com.google.HTTPStatus error 400.)" UserInfo=0x6a03a350 {data=<7b0a2020 22657272 6f722220 3a202269 6e76616c 69645f63 6c69656e 74220a7d>, json=<CFBasicHash 0x6a01b6b0 [0xac0251a0]>{type = mutable dict, count = 1,
entries =>
2 : <CFString 0x6a01b720 [0xac0251a0]>{contents = "error"} = <CFString 0x6a054b90 [0xac0251a0]>{contents = "invalid_client"} 

or from the xcode log:

2012-06-15 10:49:30.627 YouTubeSample[976:b03] Error Error Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be completed. (com.google.HTTPStatus error 400.)" UserInfo=0x6980d2c0 {data=<7b0a2020 22657272 6f722220 3a202269 6e76616c 69645f63 6c69656e 74220a7d>}
Error data:
{
error = "invalid_client";
}

I have tried creating and entering new client ids to avail. It looks like the secret is not being sent properly because I get the same result if I deliberately corrupt it or even leave it blank.

Any suggestions?

Rob
  • 121
  • 1
  • 3
  • How i can get client-id..and if u had done the successful completion of GDATA API then please share me your sample code. –  Jul 05 '12 at 07:14
  • I have this error too sometimes. And then it magicly works a couple of minutes later. As if it was a connection problem. Havn't found a solution up to this moment – Stephan Celis Dec 12 '12 at 08:09

4 Answers4

32

I am a little late but it might help others..

In the Google API-Console create a new client ID and set it to "Other" instead of "iOS". It should work.

atastrophic
  • 3,153
  • 3
  • 31
  • 50
  • You right! Last question - why does it happends? Maybe coz ios clientID contains info about Redirect URI? How to use that? – Valerii Pavlov Jul 03 '12 at 11:24
  • 1
    I really have no idea why it works =/. But it does. Also, I used GTMOAuth libraries that handle the redirection themselves. I never put any redirect URL in API-Console myself. – atastrophic Jul 03 '12 at 17:06
  • Thank you. I've spent about an hour struggling with this strange error. – Heitara Jul 12 '12 at 01:05
  • This is very strange. It worked for me also. Has anyone tried it on an app that has been released on the app store. – zirinisp Jan 15 '13 at 17:08
  • Non-useful now. Google Maps SDK for iOS switching on has helped for me. – Vyacheslav Mar 19 '14 at 11:34
1

I had the same issue and the problem was that the "Google Maps SDK for iOS" in Google APIs Console Services Section was disabled.

konpach
  • 11
  • 1
0

The client ID and secret must be issued by the Google API console, specifically for installed applications (not for web applications.)

grobbins
  • 1,564
  • 1
  • 8
  • 6
  • 1
    Yes I have done that. We actually have a different code sample working with the same ID and secret so I dont think that's the problem. We would like to get the sample code working though, as we would like to use the resumable upload feature that's implemented in the sample. But no matter what I try I can't get this code to work. I have tried creating new secrets and they are definitely set to "application" not web. It looks like the secret is just not being sent... – Rob Jun 17 '12 at 23:59
0

In my case I was not using correct project name. I was using project alias name. After Using correct project name it fixed my issue.

Shashi3456643
  • 2,021
  • 17
  • 21