Use dataWithContentsOfURL with cookie data

Goodmorning,
I hope someone can help?

I’m making calls to a website with the following code:

– load page
set pageURL to NSURL’s URLWithString:mUrl
set {pageHTML, theError} to NSData’s dataWithContentsOfURL:pageURL options:0 |error|:(reference)

But after some time it doesn’t respond no mote because, after some testing in a browser, it want’s you to login before you can continue.
I can see in the cookies of that website it then uses a TAuthn and a TKey… how can I use these to load the HTML of the website again?

I’m still looking for a way to do this…
I found some possibility with NSURLCredential
But when creating the following line SD always crashes while in script editor I get a object… (a crash report has been sent)

use framework “Foundation”

property NSURLCredential : a reference to current application’s NSURLCredential

set urlCredential to NSURLCredential’s alloc’s init

I’ve never used it, however you’re asking for trouble if you call methods like alloc and init without parentheses. And a quick look at the docs suggests you might be better off using credentialWithUser:password:persistence:.