我如何可以访问谷歌帐户USER_ID? [英] How can I access the Google account user_id?

查看:174
本文介绍了我如何可以访问谷歌帐户USER_ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想访问用户的谷歌帐户 USER_ID 了解认证,但我看不出在这个任何提及 的AccountManager

I'd like to access the user's Google account user_id for authentication, but I don't see any mention of this in the AccountManager.

哪有我的应用程序请求 USER_ID

How can my app request the user_id?

推荐答案

现在,<一个href=\"https://developers.google.com/android/google-play-services/reference/com/google/android/gms/auth/package-summary\"相对=nofollow>谷歌播放服务是可用的,你可以用它来要求用户的访问 https://www.googleapis.com/auth/userinfo.profile <许可/ code>的范围和,用得到的访问令牌,做出 https://www.googleapis.com/oauth2/v1/userinfo?access_token= {}的accessToken 来得到他们的用户ID。

Now that Google Play Services is available, you can use it to request the user's permission to access the https://www.googleapis.com/auth/userinfo.profile scope and, with the resulting access token, make a request to https://www.googleapis.com/oauth2/v1/userinfo?access_token={accessToken} to get their user ID.

这篇关于我如何可以访问谷歌帐户USER_ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆