Skip to content

Instantly share code, notes, and snippets.

View seccomiro's full-sized avatar

Diego Stiehl seccomiro

View GitHub Profile
@seccomiro
seccomiro / BasicAuthInterceptor.kt
Last active October 17, 2024 07:57
An adaptation in Kotlin of Rajasekhar's answer at https://stackoverflow.com/a/43366296/1148768
import okhttp3.Interceptor
import okhttp3.Credentials
import okhttp3.Response
import java.io.IOException
class BasicAuthInterceptor(user: String, password: String) : Interceptor {
private val credentials: String = Credentials.basic(user, password)
@Throws(IOException::class)