ios - Set the header in ASIHTTPRequest -
i'm using asihttprequest access web based api , need set header app authentication. note not server level authentication @ api level. i've tried every thing find , of answers on web ones here @ www.stackoverflow.com tell me use like:
[request addrequestheader:@"username" value:@"asdf"];
this not work me. guy built api i'm using told me need set header as:
authorization: truerest username=personname&password=pass&apikey=dfiu6aewruif3bismillah4rah3anarahimiimi22mydad
so tried following:
nsurl *url = [nsurl urlwithstring:@"http://ifish-uk.co.uk/rest_users/login.json"]; asihttprequest *request = [asihttprequest requestwithurl:url]; [request addrequestheader:@"username" value:@"myuser"]; [request addrequestheader:@"password" value:@"mypass"]; [request addrequestheader:@"apikey" value:@"dfiu6aewruif3bismillah4rah3anarahimiimi22mydad"];
but didn't work... tried setting request type get because developer told me should this:
[request setrequestmethod:@"get"];
this didn't work... api developer told me made module follow:
post /rest_catches/add.json http/1.1 host: ifish-uk.co.uk authorization: truerest username=myuser&password=mypass&apikey=dfiu6aewruif3bismillah4rah3anarahimiimi22mydad cache-control: no-cache
any appreciated.
you should add 1 header authorization no need add separate headers each field (use, pass, etc).
fill specific values , send.
[request addrequestheader:@"authorization" value:@"truerest username=personname&password=pass&apikey=dfiu6aewruif3bismillah4rah3anarahimiimi22mydad"];
Comments
Post a Comment