Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dinorahto/674d8ac2b6b66945283d92863f6bbc50 to your computer and use it in GitHub Desktop.
Save dinorahto/674d8ac2b6b66945283d92863f6bbc50 to your computer and use it in GitHub Desktop.
Interceptor Autheticator OkhttpClient
/**
* OkHttpClient
*/
@Provides
@Singleton
fun getUnsafeOkHttpClient(): OkHttpClient {
val interceptor = HttpLoggingInterceptor()
interceptor.level = HttpLoggingInterceptor.Level.HEADERS
interceptor.level = HttpLoggingInterceptor.Level.BODY
val builder = OkHttpClient.Builder()
builder.addInterceptor(interceptor)
.connectTimeout(20, TimeUnit.SECONDS)
.readTimeout(20, TimeUnit.SECONDS)
.addInterceptor(SupportInterceptor())
.authenticator(SupportInterceptor())
return builder.build()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment