应用服务器联想谷歌帐户,以一个用户的设备如何?帐户、服务器、用户、设备

2023-09-06 05:12:44 作者:厌世

我希望用户能够从Web服务器和/或本机PC应用程序中输入数据,并在很大程度上转移到他们所选择的Andr​​oid设备同样的方式,谷歌播放的安装在设备上的作品。

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.

我想使用用户的谷歌账户认证建立应用服务器之间的链接并且用户的Andr​​oid设备与GCM注册。

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.

我找不到任何提及如何处理这种认证在谷歌云消息的 API文档,但没找到这个悬而未决的问题在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.

我想从通过他或她的谷歌帐户的Web应用程序验证用户身份。同样,Android应用程序会以某种方式获得相同的谷歌帐户的手柄,这将在同一时间初始GCM注册被发送到Web应用程序服务器一次。

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.

然后,当用户使用Web应用程序,该服务器提供用户已经注册到服务器的设备的列表,使得用户可以被提示关于哪些机器人装置,他或她想将数据发送到

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.

我怎样才能做到这一点的Web服务器上,以及在设备上?

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?

推荐答案

您应该使用 USER_ID 是从谷歌帐户服务器后的注册唯一识别每个用户。电子邮件地址不应该被用于有许多原因:

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:

在访问电子邮件地址可能需要用户额外的权限和使用,因为信任问题,你的服务/应用程序阻止用户。 为确保用户的电子邮件地址数据库中添加的责任 用户可能会改变他们的电子邮件地址,在谷歌账户,但不能改变自己的用户ID。 用户可以关联与多个用户ID的电子邮件地址,所以就不一定是唯一的。

下面的序列图显示了从客户端Android应用程序初始登记:

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

下图显示了当一个客户端需要从浏览器访问自己的设备发生了什么:

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

请注意,尽管未示出,客户端Android应用程序现在可以如经由应用服务器所需通信返回到客户端浏览器。

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