2

我想利用谷歌照片。我的理解是它使用与 Picasa 相同的 API。我正在使用 OAuth 并使用 JQuery 发出请求。不幸的是,我所有的请求都返回:

Token invalid - AuthSub token has wrong scope

Picasa 文档声明使用以下范围:

http://picasaweb.google.com/data/

我将它与 OAuth Javascript 库一起使用,如下所示:

gapi.signin2.render('my-signin2', {
'scope': 'http://picasaweb.google.com/data/',
'width': 200,
'height': 50,
'longtitle': true,
'theme': 'light',
'onsuccess': this.onSignIn
});

我能够进行身份验证并正确接收 access_token。返回的身份验证对象中列出的范围是:

https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/picasa openid email profile

对 Picasa 服务的请求采用以下形式:

https://picasaweb.google.com/data/feed/api/user/default?access_token=some-real-token

知道我做错了什么吗?

4

1 回答 1

1

看起来没有使用提供给 signin2.render 的选项参数中设置的范围。相反,我不得不把它放在我的 index.html 中:

  <meta name="google-signin-scope" content="https://picasaweb.google.com/data/">
于 2016-03-10T04:33:48.940 回答