BasicAuth

Estimated reading time: 1 minute

This feature sends an Authorization: Basic with the specified credentials:

This feature is defined in the class io.ktor.client.features.auth.basic.BasicAuth in the artifact io.ktor:ktor-client-auth-basic:$ktor_version.
dependencies { compile "io.ktor:ktor-client-auth-basic:$ktor_version" }
dependencies { compile("io.ktor:ktor-client-auth-basic:$ktor_version") }
<project> ... <dependencies> <dependency> <groupId>io.ktor</groupId> <artifactId>ktor-client-auth-basic</artifactId> <version>${ktor.version}</version> <scope>compile</scope> </dependency> </dependencies> </project>

Install

val client = HttpClient(HttpClientEngine) {
    install(BasicAuth) {
        username = "username"
        password = "password"
    }
}

This feature implements the IETF’s RFC 7617.