'The Scope Was bad or missing' error trying to use AuthSub with google health?
I'm trying to use AuthSub to request a token from google health. It says the scope was bad or missing. I've double checked, and the scope looks good to me. I've tried replacing the scope with calendar, and I don't get that error.
Here's a开发者_C百科 code snippet
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)
I'm not familiar with Google Health, but did some Googling and you need to register your site first:
https://services.google.com/fb/forms/googhealthdevelopers/
It takes a week for this registration to go through. Meanwhile you can test against H9 sandbox with an url like:
https://h9.google.com/h9/authsub?next=http://localhost:8080/auth&scope=https://www.google.com/health/feeds/&secure=0&session=1
So apparently if you try to use Google Health through https://www.google.com/accounts/AuthSubRequest before registering your site, then you get that error message. How you are supposed to test against localhost if you have to register your site first, I have no idea.
精彩评论