【发布时间】:2019-09-23 19:08:01
【问题描述】:
我想在node.js 中为我的移动应用创建一个安全 API。
基本上我希望用户能够通过应用程序创建他们的帐户(使用电子邮件和密码),所以我想知道什么是正确的方法。我想像这样:
curl -d '{"email":"hello@world", "password":"1234"}' -H "Content-Type: application/json" -X POST https://myapi/users
所以服务器会回复新创建的用户和 oauth 常用令牌,以便验证下一个请求:
{
id: '1234455656',
email: 'hello@world',
auth_token: 'my_auth_token'
refresh_token: 'my_refresh_token'
}
感觉这不是最好的安全方式,因为即使没有应用程序,任何人都可以创建用户,我想知道应用程序通常是如何处理这个问题的?也许还有比快递更好的东西来做好这件事
【问题讨论】: