在 API 中发送纯密码或加密密码

Send Plain or Encrypted Password in API

之前我使用 md5 进行解密,但后来我切换到 BCrypt,这是一个更好的选择。

假设我开发了一个 API 并且其中有一个 用户登录 的服务。我尝试使用邮递员调用此服务并传递所需的参数,即 usernamepassword.

现在,我不知道这是否可能,但如果一些黑客拦截了我的请求怎么办?如果他能截获它,那意味着他能看到我在请求参数中发送的明文密码,对吧?

如果可能的话,在这里最好的事情是什么?我是否必须在 API 中输入以 Bcrypt 加密的密码?

P.s。我对我的 API 使用基于 JWT 的身份验证。

为您的 API 请求使用 HTTPS 而不是 HTTP。那么中间人攻击就很难或不可能了。

始终使用 post 方法而不是 get 或任何其他方法来发送机密数据

"Implementing the use of TLS and HTTPS would provide effective encryption and authentication of transmitted data to protect the website from Man-in-the-Middle attacks. This effectively obstructs the decryption of confidential data like authentication keys" << Read More.....