问题描述
有人可以告诉我为什么我无法使用相同的令牌从Google检索userInfo和日历列表?
我设置了正确的范围(我认为) :
private static final String PLUS_ME_SCOPE =https://www.googleapis.com/auth/plus.me;
private static final String USER_INFO_PROFILE_SCOPE =https://www.googleapis.com/auth/userinfo.profile;
private static final String USER_INFO_EMAIL_SCOPE =https://www.googleapis.com/auth/userinfo.email;
private static final String GOOGLE_CALENDAR_SCOPE =https://www.googleapis.com/auth/calendar;
要获得用户信息,我使用这个url:和对于我使用的日历:。
在用户信息中我获得所有正确的信息,但日历我收到错误401:需要登录。
这里有什么问题?
更改
到
就这么简单)
UPDATE:
另请注意,不推荐指定:
Can someone tell me why I can't use the same token to retrieve userInfo and calendars list from Google?
I have set the correct scopes (I think):
private static final String PLUS_ME_SCOPE = "https://www.googleapis.com/auth/plus.me";
private static final String USER_INFO_PROFILE_SCOPE = "https://www.googleapis.com/auth/userinfo.profile";
private static final String USER_INFO_EMAIL_SCOPE = "https://www.googleapis.com/auth/userinfo.email";
private static final String GOOGLE_CALENDAR_SCOPE = "https://www.googleapis.com/auth/calendar";
To get the user info I use this url: https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token= and for calendars I use: https://www.googleapis.com/calendar/v3/users/me/calendarList?minAccessRole=writer&key= .
In user Info I get all the correct info but for the calendar I get Error 401 : Login Required.
What's wrong in here?
Change
to
Just that simple ;)
UPDATE:
Also note, that it is not recommended to specify the access token as a query parameter:
这篇关于OAuth令牌适用于userInfo,但不适用于Google日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!