Connecting to URL requires authentication in Kotlin
I'm beginner in kotlin.
I'm try to connect to my http service, wich requires authentication.
Have error: Unresolved reference: Authenticator
How can I set Authenticator?
var url = URL ("
https://myURL")
val authenticator = object : Authenticator() {
val passwordAuthentication: PasswordAuthentication?
get() = PasswordAuthentication(
"user",
"password".toCharArray()
)
}