簡體   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