5

I have created a new project and turned on YouTube Data API v3. In API access pane I have Key for browser apps (with referers) created, witch works fine. I went ahead and created Key for iOS apps (with bundle identifiers). Everything looks well I have checked the bundle id 10 times, I am sure it is correct. However if I go ahead and create NSURLRequest from my iOS app using iOS API key I get error response:

error =     {
    code = 403;
    errors =         (
                    {
            domain = usageLimits;
            message = "Access Not Configured";
            reason = accessNotConfigured;
        }
    );
    message = "Access Not Configured";
};
}

Using same url only passing my Key for browser apps (with referers) work without any issues.

NSString *string=[NSString stringWithFormat:@"https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=%@&fields=items(id,snippet(channelId,title,categoryId),statistics(viewCount))&part=snippet,statistics",key];

I am really puzzled on what is the problem here, I have been trying to get it to work with iOS app Key hours now. Is there something obvious Im missing ?

stringCode
  • 2,274
  • 1
  • 23
  • 32
  • 1
    I would recommend asking at https://groups.google.com/forum/?fromgroups#!forum/google-api-objectivec-client or opening an issue at https://code.google.com/p/google-api-objectivec-client/issues/list since this sounds like something very specific to the Objective-C client library. – Jeff Posnick Mar 19 '13 at 16:37
  • thank you for your comment. You see I am not using Objective-C client library, I am creating NSURLRequest, parsing json response etc. Now that you mentioned, I suspect that I need to use it, in order to use iOS api key. Would you happen to have any knowledge wether it is allowed to use NSURLRequest from iOS app to communicate with YouTube DATA API v3. As I have already written a lot of code that handles is. Thank you again – stringCode Mar 20 '13 at 14:35
  • 2
    I really don't know how iOS-specific API keys work—sorry! I'd actually think that you'd want to use the browser-based key if you're just making raw HTTP requests from your app. – Jeff Posnick Mar 20 '13 at 16:24
  • Thank you for you comments, I do appreciate your help. Im going ahead and using raw HTTP and web API key. If you want to post your comment as answer I will accept it as right answer. – stringCode Mar 21 '13 at 03:36
  • I have the same problem, but I'm using the Objc Google Client. Using the API Key for Browser solved my issue, but why would they offer a key for iOS devices if it won't work? – Pedro Mancheno Apr 16 '13 at 15:44
  • This continues to be an issue. Does anyone know why this is the case? – David Poxon Jan 03 '15 at 04:40

3 Answers3

7

If you're making raw HTTP requests from any application (iOS or otherwise), then you can include the "key for browser apps" as the key= URL parameter and it should be sufficient (at least for read-only, non-authenticated calls).

Jeff Posnick
  • 53,580
  • 14
  • 141
  • 167
1

If you restrict your API to iOS application you must include the bundle id with the parameter x-ios-identifier-bundle-identifier on request's header

https://groups.google.com/forum/#!topic/google-cloud-endpoints/I-u3sAUU3Ts

Bruno Lima
  • 11
  • 1
0

This appears to be working - add as an HTTP referrer just like a full www domain:

chrome-extension://${chrome.runtime.id}/
Sangram Shivankar
  • 3,535
  • 3
  • 26
  • 38
11teenth
  • 1,853
  • 1
  • 15
  • 28