ios - AFNetworking: How/when to prompt for username and password for BASIC Auth? -
i'm looking best-practice prompting user credentials. have code possibility after user logs in phone, he/she login device or webpage , change password. since i'm doing basic auth, token incorrect , need handle appropriately.
i've started new project afnetworking. have subclassed afhttpclient , i've overridden httprequestoperationwithrequest message set authentication challenge block on after make call super. in block should create new nsurlcredential object , send sender. far.
what don't how i'm supposed prompt user. ideally i'd push login screen on nav controller login button. clicking login button create nsurlcredential , send sender.
- should somehow block inside challenge block? doesn't seem right.
- should save nsurlauthenticationchallenge object global? eww.
- should push login page subclassed afhttpclient? sounds i'm violating separation of concerns.
- should call appdelegate prompt user , pass nsurlauthenticationchallenge object it? sounds better, still unsure.
Comments
Post a Comment