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
1. val client = HttpClient() {
2. install(Auth) {
3. // providers config
4. ...
5. }
6. }
Providers
Basic
This provider sends an Authorization: Basic with the specified credentials:
1. val client = HttpClient() {
2. install(Auth) {
3. basic {
4. username = "username"
5. password = "password"
6. }
7. }
8. }
This feature implements the IETF’s RFC 7617.
Digest
This provider sends an Authorization: Digest with the specified credentials:
1. val client = HttpClient() {
2. install(Auth) {
3. digest {
4. username = "username"
5. password = "password"
6. realm = "custom"
7. }
8. }
9. }
This feature implements the IETF’s RFC 2617.

