【问题标题】:Is there any concept like google plus app access token有没有像google plus app access token这样的概念
【发布时间】:2014-04-06 15:09:49
【问题描述】:

我目前正在为 Google+ 开发一个应用。有没有办法在没有用户身份验证的情况下获取/搜索公共数据,我的意思是,使用应用访问令牌

https://www.googleapis.com/oauth2/v1/activities

【问题讨论】:

    标签: api oauth-2.0 google-plus google-oauth


    【解决方案1】:

    是的,请参阅 https://developers.google.com/+/api/oauth#apikey,其中谈到了使用 API 密钥而不是使用用户登录。

    引用该页面:

    对于不需要识别特定用户的 Google+ API 调用,您可以使用您的应用程序 API 密钥。这对于服务器端应用程序或不需要用户使用 Google 登录的 Web 应用程序很有用。

    [...]

    获得 API 密钥后,您的应用程序可以将查询参数 key=yourAPIKey 附加到所有请求 URL。 API 密钥对于嵌入 URL 是安全的;它不需要任何编码。

    您可以通过新的开发者控制台获取 API 密钥,方法是转到 http://console.developers.google.com/ 并选择您的项目,然后单击左侧的 APIs & auth 选项卡,然后单击 Credentials。 Public API Access 右侧应该有一个部分,如果一个新密钥不存在,则按下该按钮可以创建一个新密钥。

    【讨论】:

      【解决方案2】:

      仍然没有运气,

      回复如下:

      数组 ( [网址] => https://www.googleapis.com/oauth2/v1/activities?query=stackoverflow&maxResults=100&orderBy=recent&key=54XXXXXXX4723.apps.googleusercontent.com [内容类型] => 文本/html;字符集=UTF-8 [http_code] => 404 [header_size] => 390 [请求大小] => 262 [文件时间] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [总时间] => 0.813163 [namelookup_time] => 0.411874 [连接时间] => 0.454496 [pretransfer_time] => 0.605186 [大小上传] => 0 [大小下载] => 9 [速度下载] => 11 [速度上传] => 0 [下载内容长度] => -1 [上传内容长度] => 0 [starttransfer_time] => 0.813109 [重定向时间] => 0 [certinfo] => 数组 ( )

      [primary_ip] => XXX.XXX.XXX.XX
      [primary_port] => 443
      [local_ip] => 192.XXX.XXX.XXXX
      [local_port] => 52227
      [redirect_url] => 
      

      )

      【讨论】:

        【解决方案3】:

        密钥周围的答案对于一般公众访问是正确的。但是,您使用的 URL 不正确。你想要我怀疑的活动列表 API:https://developers.google.com/+/api/latest/activities/list

        GET https://www.googleapis.com/plus/v1/people/{userId}/activities/public?key={YOUR_KEY}

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2010-10-17
          • 2019-06-07
          相关资源
          最近更新 更多