Textalk / jquery.jsonrpcclient.js

JSON-RPC 2.0 Client for HTTP and WebSocket backends
MIT License
72 stars 28 forks source link

How can I setuo authentication with json rpc client ? #35

Open scramatte opened 8 years ago

scramatte commented 8 years ago

Hello, We have got a web service protected by basic auth. How can I setuo authentication with json rpc client ?

Thnak you

fiddur commented 8 years ago

You might be able to add it as additional headers in options.headers on instantiation. I've never tried…

ThierryMartin commented 8 years ago

Hello,

If you read the previous lines, you might find the code below helpful. It works at least under FF. (the "auth" code is copied from https://github.com/jpillora/jquery.rest project).

To set user and password : var foo = new $.JsonRpcClient({ ajaxUrl: '/backend/jsonrpc' , username : 'username', password : 'password' });

Regards

/**

})(this.jQuery);