Closed jhs closed 13 years ago
Fixed in latest head. You can now pass basic auth info (and proxy or ssl) in Db options, oauth is coming. For example:
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -pa ./ebin
-module(changes).
main(_) ->
couchbeam:start(),
Server = couchbeam:server_connection(),
{ok, Db} = couchbeam:open_db(Server, "testdb", [{basic_auth, {"guest", "test"}]),
{ok, ReqId} = couchbeam:changes_wait(Db, self(), [{heartbeat, "true"}]),
io:format("StartRef ~p~n", [ReqId]),
get_changes(ReqId).
get_changes(ReqId) ->
receive
{ReqId, done} ->
ok;
{ReqId, {change, Change}} ->
io:format("change ~p ~n", [Change]),
get_changes(ReqId);
{ReqId, {error, E}}->
io:format("error ? ~p ~n", [E])
end.
The changes code is different from all other requests and it forgets to set the
Authorization
header.Please see my pull request for a patch, or see jhs/couchbeam@master