Google YouTube API v3 iOS 应用密钥,403 错误代码 [英] Google YouTube API v3 iOS app key, 403 error code

查看:17
本文介绍了Google YouTube API v3 iOS 应用密钥,403 错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新项目并启用了 YouTube Data API v3.在 API 访问窗格中,我创建了浏览器应用程序的密钥(带有引用程序),女巫工作正常.我继续为 iOS 应用程序创建了 Key(带有包标识符).一切看起来都很好,我已经检查了包 ID 10 次,我确定它是正确的.但是,如果我继续使用 iOS API 密钥从我的 iOS 应用程序创建 NSURLRequest,我会收到错误响应:

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";
};
}

使用相同的 url 只传递我的浏览器应用程序的密钥(带引用)工作没有任何问题.

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];

我真的很困惑这里的问题是什么,我一直在尝试让它与 iOS 应用程序一起使用 Key hours 现在.有什么明显的我遗漏了吗?

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 ?

推荐答案

如果您要从任何应用程序(iOS 或其他应用程序)发出原始 HTTP 请求,那么您可以将浏览器应用程序的密钥"作为 key= URL 参数,它应该足够了(至少对于只读、非身份验证的调用).

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

这篇关于Google YouTube API v3 iOS 应用密钥,403 错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆