如何在谷歌购物中使用API KEY

问题描述 投票:0回答:1

我试图执行内容API的方法,所以,当我测试以下网址时:

https://www.googleapis.com/content/v2.1/accounts/authinfo?key={YOUR_API_KEY}

服务的调用检索我:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Login Required",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Login Required"
 }
}

但仍然向我显示同样的错误。请参阅此集成的任何指南,我需要从C#控制台应用程序调用它,而不是使用OAuth2的网站应用程序。

c# google-api google-oauth2 google-api-dotnet-client google-shopping-api
1个回答
0
投票

如果你查看Accounts: authinfo的文档,你不能

它明确指出您必须使用以下范围进行身份验证

enter image description here

您需要添加Oauth2并登录。您使用服务帐户的事实并未改变您必须具有访问私人用户数据的权限这一事实。 Api密钥只能用于访问公共数据。如果您只访问自己的帐户,那么您可能需要考虑使用service account

© www.soinside.com 2019 - 2024. All rights reserved.