繁体   English   中英

尝试从ios应用中获取google +个人资料图片时,为什么会收到错误代码403?

[英]Why am I getting error code 403 while trying to fetch google+ profile image from my ios app?

我有某个用户的google iD,我想在我的应用中显示他的google个人资料照片。 在我的swift代码中,我尝试获取带有必要信息的json(基于此答案https://stackoverflow.com/a/22526130/3766930 )。 这是我的代码:

 Alamofire.request(.GET, "https://www.googleapis.com/plus/v1/people/10263...4252?key=AI...Oo")
            .responseJSON { response in

                print(response)
                switch response.result {
                case .Success:

                    dispatch_async(dispatch_get_main_queue(),{

                        if let jsonData = response.result.value as? [[String: AnyObject]] {
                            print(jsonData)
                        }

                    })
                case .Failure(let error):
                    print("SWITCH ERROR")
                    print(error)
                }

        }

但作为回应,我收到此错误:

    error =     {
        code = 403;
        errors =         (
                        {
                domain = usageLimits;
                extendedHelp = "https://console.developers.google.com";
                message = "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.";
                reason = ipRefererBlocked;
            }
        );
        message = "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.";
    };

我仔细检查了Google开发人员控制台,但没有设置任何IP限制。 到目前为止是这样的:

我从这里使用api密钥:

在此处输入图片说明

在此处输入图片说明

如您所见,这里没有域限制:

在此处输入图片说明

这个奇怪的错误可能是什么原因?

删除Google Developers Console中API密钥的iOS捆绑包标识符限制。 捆绑包标识符限制仅在使用Google客户端库时有效

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM