Auth
note
This help topic is in development and will be updated in the future.
Ktor client supports authentication out of the box as a standard pluggable feature.
Installation
val client = HttpClient() {
install(Auth) {
// providers config
...
}
}
Providers
Basic
This provider sends an Authorization: Basic
with the specified credentials:
val client = HttpClient() {
install(Auth) {
basic {
username = "username"
password = "password"
}
}
}
This feature implements the IETF’s RFC 7617.
Digest
This provider sends an Authorization: Digest
with the specified credentials:
val client = HttpClient() {
install(Auth) {
digest {
username = "username"
password = "password"
realm = "custom"
}
}
}
This feature implements the IETF’s RFC 2617.