Google Cloud Endpoints User#getUserId different than profile id on Google+

妖精的绣舞 提交于 2019-12-13 04:34:04

问题


I've been writing application for appengine, using GWT and Cloud Endpoints. For Cloud Endpoints I use authorization as shown here: Using Auth with Endpoints. With scope https://www.googleapis.com/auth/userinfo.email. Because I need different roles for users, I've tried to use User#getUserId and I thought this will be the id of Google+ profile. Although that's not true and this is completely different (well, it has the same length). The problem is, I can't find out, how to find this id a different way than User#getUserId and thus it makes it really difficult to add new users to admin roles. I've also tried to use different scopes, but it didn't work.

My question is, why is this id different from the Google+ id and if there is a way to simply obtain the Google+ id?

These are the values I'm talking about:
Id from User#getUserId: 101329505878094971459
Id from Google+ profile: 113085797747084826112


回答1:


Use the Google+ API.

You can't get a user's Google+ ID without them consenting to giving you their Google+ ID.



来源:https://stackoverflow.com/questions/18280588/google-cloud-endpoints-usergetuserid-different-than-profile-id-on-google

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!