应用程序服务器如何将谷歌账户与用户的设备联系起来?[英] How can an application server associate Google accounts to a user's device?

本文是小编为大家收集整理的关于应用程序服务器如何将谷歌账户与用户的设备联系起来?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我希望用户能够从Web服务器和/或本机PC应用程序输入数据,并以与Google Play在设备上的Works On Works On Works Works的方式传输到其选定的Android设备.

我想使用用户的Google帐户 authentication 建立应用程序服务器之间的链接以及用GCM注册的用户的Android设备.

我找不到有关如何处理这种身份验证的任何提及. " nofollow"> api文档,但确实找到了此推荐答案

您应该使用 user_id Google帐户服务器 registration 以唯一地识别每个用户.由于多种原因,不应使用电子邮件地址:

  • 访问电子邮件地址可能需要用户的额外权限,并因信任问题而劝阻用户使用您的服务/应用程序.
  • 增加了确保用户电子邮件地址数据库的责任
  • 用户可以在Google帐户中更改其电子邮件地址,但不能更改其用户ID.
  • 用户可以将一个电子邮件地址与多个用户ID相关联,因此不一定是唯一的.

以下序列图显示了客户端Android App的初始注册:

来自客户端Android App的初始注册> </p>

<p>下一个图显示了客户要从浏览器访问其设备时发生的情况:</p>

<p> <img src =

请注意,尽管未显示,但客户端应用程序现在可以通过应用程序服务器(如果需要)进行连接到客户端浏览器.

其他推荐答案

user_id 您在注册时从设备上获取使用GCM应该与使用OAuth代币获得的User_id相同.只需将OAuth代币和注册ID存储在您的用户存储库中,并将两者都与user_id关联.

在此处输入图像说明

本文地址:https://www.itbaoku.cn/post/102310.html

问题描述

I want users to be able to enter data from a web server and/or native PC app and transfer it to their chosen Android device in much the same way that Google Play's install on device works.

I'd like to use the user's Google account authentication to establish a link between the application server and the user's Android device that registered with GCM.

I couldn't find any mention of how to handle this kind of authentication in the Google Cloud messaging API documentation, but did find this unanswered question in the GCM forums.

I'd like to authenticate users from a web application via the his or her Google account. Similarly, the Android application would somehow obtain a handle on the same Google Account, which would be sent to the web application server once at same time as initial GCM registration.

Then when the user uses the web application, the server provides a list of devices the user has already registered to the server, so that the user can be prompted about which Android device he or she would like to send data to.

How can I accomplish this on the web server as well as on the device?

What information can I use after authenticating with the Google account to establish a link between the two logins?

推荐答案

You should use the user_id that is returned from the Google account server after registration to uniquely identify each user. Email addresses shouldn't be used for a number of reasons:

  • Accessing email addresses may require additional permissions from the user and dissuade users from using your service/app because of trust issues.
  • Adds liability for securing database of users' email addresses
  • Users may change their email addresses in Google accounts but cannot change their user IDs.
  • Users can associate one email address with more than one user ID, so it is not necessarily unique.

The following sequence diagram shows the initial registration from client Android app:

initial registration from client Android app

The next diagram shows what happens when a client wants to access his device from a browser:

client wants to access his device from a browser

Note that although not shown, the client Android app can now communicate back to the client browser if needed via the application server.

其他推荐答案

The user_id you get from the device when you register with GCM should be the same as the user_id you get with your OAuth token for your app. Just store the OAuth token and Registration ID in your user repository, associating both with the user_id.

enter image description here