ios - Share authentification between WKWebview and NSURLRequest -
i trying replace login screen of website custom, native one.
the way website set up, login ui on front page (http://www.example.com/), ajax credentials api (http://api.example.com/). because of this, setting auth header on front page not work, , needs set first time hitting api.
my idea send login request api through nsurlrequest
, workd great itself. however, token not retained or shared wkwebview, therefore front page not recognise user logged in.
is there way share auth token between 2 requests, or add auth token page requested through ajax? thank you.
check out nsurlprotocol
, defines how urls loaded in application. inject credentials/sessionid in each request in application after login successful.
here great tutorial : http://nshipster.com/nsurlprotocol/ , 1 webviews : http://www.raywenderlich.com/59982/nsurlprotocol-tutorial
Comments
Post a Comment