如何安全地将在浏览器上验证过的电子邮件地址传输到服务器?

How to securely transfer to the server an email address that was authenticated on the browser?

我可以使用在客户端实现 oauth2 协议的“hello.js”库来获取通过第三方应用程序(Google 和 Facebook)验证的用户的电子邮件地址。

当然可以通过 HTTPS 将电子邮件地址发送到服务器,但是如何防止交换被欺骗?也就是说,服务器如何确保从浏览器收到的电子邮件地址是通过第三方应用程序验证的电子邮件地址?

也许电子邮件地址在发送给“redirect_uri”的消息中的某处,它在到达客户端的途中通过服务器,但如果是这样,我找不到它。它不在 GET 或 POST 参数中。

Andrew Dodson,"hello.js" 的作者,非常友好地在 Gitter 上为我回答了这个问题。他写道:

The client side web app needs to send the token (find it after login with hello('facebook').getAuthResponse().access_token) back to your server. This token can be used anywhere to make an API request to the third party.

因此浏览器不会将实际的电子邮件地址发送到服务器。相反,它发送令牌,然后服务器使用令牌向第三方应用程序询问与该令牌关联的电子邮件地址。