我正在使用cookie身份验证实现自定义身份验证。所以,我在玩同步网关REST API来创建用户和会话。我可以成功创建用户,但无法通过/ _session API创建会话。 以下是我遵循的步骤。无法通过CouchBase同步网关创建会话管理REST API
1.创建用户
POST /cookbook/_user/ HTTP/1.1
Host: localhost:4985
Content-Type: application/json
{
"name": "chef123",
"password": "1234"
}
2.让用户
GET /cookbook/_user/ HTTP/1.1
Host: localhost:4985
Content-Type: application/json
Respone :["chef123"]
3.创建会话
POST /cookbook/_session HTTP/1.1
Host: localhost:59840
Content-Type: application/json
{
"name": "chef123",
"ttl": 1800
}
Expected:
{
"cookie_name": "SyncGatewaySession",
"expires": "2014-11-07T16:42:11.675519255-08:00",
"session_id": "c2425fa7d734bc8c3f6c507854166bef56a5fbc6"
}
Instead received:
{"authentication_handlers":["default","cookie"],"ok":true,"userCtx":{"channels":{},"name":null}}
任何人都可以请解释API为什么给出以下响应。
{ “authentication_handlers”: “默认”, “曲奇”], “OK”:真实的, “userCtx”:{ “通道”:{}, “名”:空}}
是你的问题解决了。我有同样的问题。该问题的 – krishnan
在请求URL的末尾是“/”。我尝试使用http:// localhost:4985/db/_session而不是http:// localhost:4985/db/_session //并且它工作正常 – krishnan