Making a request with custom authentication headers, some of which are hashed

97 views
Skip to first unread message

lou-white

unread,
Apr 4, 2012, 8:21:49 AM4/4/12
to ASIHTTPRequest
I've used ASIHttpRequest before to get JSON from APIs, but I'm having
trouble getting info from an API that I'm using, which has custom
authentication headers and other complex stuff.

Firstly, the API requires custom authentication headers:

access_id=542 // id of request
sig_method=HMAC_SHA256 // could be HMAC_MD5, HMAC_SHA1,
HMAC_SHA256
sig_base64=A34gSy1g6HVUKtzxiuJNBHcSuO+b/dwKHb/Va7fcNfZ= //
Base64 string generated from method below
message_base64=LuH6wRFhCasBrMj2f5oiu21Gw2+H/bSnP+yBwP4uTWs= //
Base64 string generated from method below

sig_base64 is a base64 hash generated from:
http verb
hostname
request Uri
access_id={key} + any query string parameters

for instance:
GET
example.com
/api/data/
access_id=1

message_base64 is needed when a body is supplied. This is also hashed.
{"User":"Paul","Version":3,"Source":"iOS"}

How would I make custom based hashed headers using ASI? Or do I need
other tools to do it all?

Thanks
Lou
Reply all
Reply to author
Forward
0 new messages