【发布时间】:2014-03-21 15:21:52
【问题描述】:
我正在实现一个 REST API,它还提供了对用户进行身份验证的功能。身份验证要求用户发送 POST 请求,正文中包含以下数据:
{
"userOrEmail": "spook",
"passowrd": "Test1234"
}
如果用户名和密码匹配,用户从服务器取回一个令牌,如果不匹配,服务器返回 401 Unauthorized,并带有以下标头:
WWW-Authenticate: Credentials realm="http://localhost:9000/auth/users/credentials"
这个标题可以接受吗? realm 包含用户可以尝试再次验证的位置。
【问题讨论】:
标签: http rest authentication