api - Getting Unauthorized error when trying to execute the RestSharp request that retrieves data from ArangoDB -


if send http request through postman works , result. same not working , getting unauthorized when execute through restsharp.

below code snippet:

var client = new restclient(    "http://username:password@localhost:port/_db/databasename/_api/simple/all"); var request = new restrequest(method.put); request.addheader("content-type", "application/json"); request.addparameter("application/json",       "{\n    \"collection\":\"collectionname\"\n}", parametertype.requestbody); irestresponse response = client.execute(request); return response; 

according the restsharp wiki cannot specify authentication parameters via url:

var client = new restclient("http://example.com"); client.authenticator = new simpleauthenticator("username", "foo", "password", "bar"); var request = new restrequest("resource", method.get); client.execute(request); 

in general idea in such case drop https, , use wireshark or ngrep inspect whats going on on wire:

get /_db/_system/_api/version?details=true http/1.1 host: 127.0.0.1 connection: keep-alive user-agent: arangodb accept-encoding: deflate authrization: basic cm9vddo= 

to inspect actualy generated authentication headers.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -