且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google *** API v3 iOS应用程序密钥,403错误代码

更新时间:2022-10-20 07:44:50

如果您从任何应用程序(iOS或其他)发出原始HTTP请求,您可以将包含为 key = URL参数,它应该足够了(至少对于只读,未经过验证的调用) p>

I have created a new project and turned on *** 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/***/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 ?

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