mkoehnke / WKZombie

WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser. It can be used to run automated tests / snapshots and manipulate websites using Javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Basic Authentication

avisual opened this issue · comments

Is there any way of doing this?

Hi @avisual . Sorry, there's currently no way to do this. But this is definitively a very important feature to have. I am surprised that nobody asked that before. I'll publish a branch (hopefully tomorrow) with the ability to handle Authentication Challenges. Stay tuned.

Cool Thanks,

How would I add that to a new Xcode project? any chance of a pointer as been using swift for about 5 days

Take a look at #45 and the branch authentication. It's not final yet, but you can try it out.

For enabling basic authentication, just add an authentication handler to your WKZombie instance like this:

browser.authenticationHandler = { (challenge) -> (URLSession.AuthChallengeDisposition, URLCredential?) in
   return (.useCredential, URLCredential(user: "user", password: "passwd", persistence: .forSession))
}

Let me know if it works.

Amazing! Thanks for the prompt response. Its been a bit of an uphill climb switching from Java to Swift 3 this week.

John

On 25 Oct 2016, at 20:02, Mathias Köhnke notifications@github.com wrote:

Take a look at #45 #45 and the branch authentication. It's not final yet, but you can try it out.

For enabling basic authentication, just add an authentication handler to your WKZombie instance like this:

browser.authenticationHandler = { (challenge) -> (URLSession.AuthChallengeDisposition, URLCredential?) in
return (.useCredential, URLCredential(user: "user", password: "passwd", persistence: .forSession))
}
Let me know if it works.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #43 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AAxeAtpBroE_AMvJjQdjxAFPlxb3ULqcks5q3lI6gaJpZM4KeitZ.

Thanks That works great