【问题标题】:'The Scope Was bad or missing' error trying to use AuthSub with google health?尝试将 AuthSub 与 Google Health 一起使用时出现“范围错误或丢失”错误?
【发布时间】:2011-08-22 21:44:33
【问题描述】:

我正在尝试使用 AuthSub 从 Google Health 请求令牌。它说范围是坏的或丢失。我已经仔细检查过,范围对我来说看起来不错。我尝试用日历替换范围,但没有收到该错误。

这是一个代码 sn-p

next = 'http://localhost:8080/auth'
# h9 scope for development
#scope = 'https://www.google.com/health/feeds/'
scope = 'https://www.google.com/calendar/feeds/'
#scope = 'https://www.google.com/h9/feeds/'
url_format = 'https://www.google.com/accounts/AuthSubRequest?next=%s&scope=%s&secure=%d&session=%d'
auth_sub_url = url_format % (next, scope, 0, 1)
#auth_sub_url = service.GenerateAuthSubURL(next, scope, secure = secure, session = session)
self.response.out.write('<a href="%s">Authorize Access to Your Google Health Account</a>' % auth_sub_url)

【问题讨论】:

  • 为我工作。当我转到您的代码生成的 URL 时,我得到一个 google 页面,询问要使用哪个帐户,然后说“站点 localhost 正在请求访问您的 Google 帐户以获取下面列出的产品。Google 日历”
  • 啊,我看到您使用日历只是为了进行健全性测试。我将重新检查健康状况。是的“范围参数错误或丢失”。

标签: python google-app-engine authentication gdata-api authsub


【解决方案1】:

我对 Google Health 不熟悉,但做了一些谷歌搜索,您需要先注册您的网站:

https://services.google.com/fb/forms/googhealthdevelopers/

完成此注册需要一周时间。同时,您可以使用以下网址对 H9 沙箱进行测试:

https://h9.google.com/h9/authsub?next=http://localhost:8080/auth&scope=https://www.google.com/health/feeds/&secure=0&session=1

显然,如果您在注册网站之前尝试通过https://www.google.com/accounts/AuthSubRequest 使用 Google Health,那么您会收到该错误消息。如果您必须先注册您的网站,您应该如何针对 localhost 进行测试,我不知道。

【讨论】:

  • 谢谢,您的链接指出对于 h9 沙箱,页面是 /authsub,而非沙箱是 /AuthSubRequest。此外,身份验证 url 使用 h9 而不是 www 作为子域,而范围仍然使用 www。再次,非常感谢!
  • 如果您不介意,请编辑您的答案,在示例网址的子域中将“www”替换为“h9”
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-11
  • 1970-01-01
  • 1970-01-01
  • 2012-03-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多