gpt4 book ai didi

node.js - 保护我的 HTTP 连接

转载 作者:可可西里 更新时间:2023-11-01 17:05:48 24 4
gpt4 key购买 nike

我目前正在从事家庭自动化项目。以下是我的设置。

A ESP8266 WiFi module will be connected to various sensors. A light web server will be running on the module. There will be a Linode Cloud deployed running certain NodeJS scripts and MongoDB database. The mobile application(Client) will be sending requests to cloud to control and monitor various sensors. I will be securing the connection between the application and cloud using JSON Web Tokens. Also I will try to use HTTPS to secure this connection.

我对如何保护云服务器和 ESP8266 模块之间的通信感到困惑。我做了很多研究。了解了某些概念,但无法获得清晰完整的画面。有人请指导我。谢谢。

最佳答案

在所有应用程序的 header 中使用 token 。当您发送请求时,它看起来像这样:

request.post({
url: 'https://mycoolserver.com/',
headers: {
Authorization: 'lalalablablabla'
}
})

更新:就您发送请求而言,该端的服务器会检查您的 token 是否与他拥有的 token 匹配。有很多安全技巧可以确保您的 token 安全,我建议的这个是非常基本的安全措施,但您可以在飞行中轻松做到这一点。稍后您可以提高安全级别。

关于node.js - 保护我的 HTTP 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44199713/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com