Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google YouTube API v3 iOS app key, 403 error code

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 ?

like image 271
stringCode Avatar asked Mar 15 '13 19:03

stringCode


People also ask

How do I fix Google authorization error 403?

"code": 403, "message": "The user does not have sufficient permissions for file {fileId}." To fix this error, instruct the user to contact the file's owner and request edit access. You can also check user access levels in the metadata retrieved by files.

How do I enable YouTube API v3?

In Google API dashboard, click Library on the left menu. Click YouTube Data API v3, then click the Enable button to enable the API service.

Why is YouTube API key not valid?

My YouTube API Key is Not Working Your API key may not be working because you're using it for the wrong project. Be sure you're using the key for the project that you created it for, especially if you created multiple projects at the same time. If it's still not working, consider creating a new API key entirely.

How do I fix Error 403 user limit exceeded?

Resolve a 403 error: User rate limit exceeded To fix this error, try to optimize your application code to make fewer requests or retry requests. For information on retrying requests, refer to Retry failed requests to resolve errors. For additional information on Gmail limits, refer to Usage limits.


2 Answers

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).

like image 115
Jeff Posnick Avatar answered Oct 11 '22 23:10

Jeff Posnick


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

like image 28
Bruno Lima Avatar answered Oct 12 '22 00:10

Bruno Lima