如何使用Android中的GMail地址获取Google用户ID? [英] How to get Google User ID using the GMail address in Android?

查看:120
本文介绍了如何使用Android中的GMail地址获取Google用户ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Android中的GMail地址获取类似于"1242343543557656"的Google用户ID?
我已对此进行搜索,并且仅找到有关如何获取Gmail地址和用户名的答案.
我想要的是Google提供给Gmail地址的唯一ID?

How to get Google User ID something which looks like "1242343543557656",using the GMail address in Android?
I have searched for this and found answers only on, how to get gmail address and the user name.
What I want is the unique id provided by google to a gmail address?

这些是我已经提到的一些链接.
-通过Android访问Google帐户ID/用户名
-如何在Android上获取Google用户名?
-获取用于下载应用程序的Google ID
-如何获取Android设备的主要电子邮件地址

These are some of the links that I have already referred.
-Accessing Google Account Id /username via Android
-How can I get the google username on Android?
-Get the Google ID used to download the application
-How to get the Android device's primary e-mail address

推荐答案

自2016/12以来的更新: Google身份工具包已由

Update as of 2016/12: The Google Identity toolkit has been superseded by Firebase Authentication.

我只是添加这个问题,因为我看到它已经获得了很多意见.必须先对用户进行身份验证,然后才能获取其Google用户ID(否则,您可以从任意电子邮件地址中提取凭据).在Android上处理此问题的推荐方法是使用Google身份工具包:

I'm just adding to this question as I see it's gotten a lot of views. The user is required to be authenticated before their Google User ID can be obtained (otherwise you could pull credentials from any arbitrary email address). The recommended way to handle this on Android is to use the Google Identity toolkit:

在您的Android应用中使用身份工具包:
https://developers.google.com/identity/toolkit/android/

Use Identity Toolkit in your Android App:
https://developers.google.com/identity/toolkit/android/

适用于Android的快速入门应用:
https://developers.google.com/identity/toolkit/android/quickstart

Quick-start app for Android:
https://developers.google.com/identity/toolkit/android/quickstart

这篇关于如何使用Android中的GMail地址获取Google用户ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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