How do I use Http Digest Auth with volley on Android -
i want use http digest volley
. far have used following code:
@override public map<string, string> getheaders() throws authfailureerror { hashmap<string, string> params = new hashmap<string, string>(); string creds = string.format("%s:%s","admin","mypass"); string auth = "digest " + base64.encodetostring(creds.getbytes(), base64.no_wrap); params.put("authorization", "digest " +auth); return params; }
so far response server wrong credentials means authentication working wrong credentials getting passed. credentials right.
you use base64 encoding fine basic auth not how digest works. digest & basic auth specs can found here: https://tools.ietf.org/html/rfc2617
the newer digest specs can found here: https://tools.ietf.org/html/rfc7616
and nice explanation on wikipedia here: https://en.wikipedia.org/wiki/digest_access_authentication
for volley implementation of digest auth can use: http://www.java2s.com/open-source/android_free_code/framework/platform/com_gm_android_volleyhttpdigeststack_java.htm
you need pass http stack when create network use create requestqueue:
requestqueue requestqueue; requestqueue = new requestqueue( new diskbasedcache(rootdir), new basicnetwork(new httpdigeststack()) ); requestqueue.start();
Comments
Post a Comment