Skip to content

Instantly share code, notes, and snippets.

View t0in4's full-sized avatar
๐Ÿ˜‡
experienced in kweb

t0in4

๐Ÿ˜‡
experienced in kweb
View GitHub Profile
@EmmanuelGuther
EmmanuelGuther / RetrofitGetAPIWithAuth.kt
Last active October 11, 2024 10:11
Get rest api with Auth - token and using okhttp Authenticator to manage the refresh token
object RetrofitGetAPIWithAuth {
private val BASE_URL = BuildConfig.API_BASE
private var retrofit: Retrofit? = null
private val tokenLoginModel: TokenLoginModel? = obtainTokenLoginModel()
private val accessToken = tokenLoginModel?.access_token
class HeaderInterceptor : Interceptor {
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
var request = chain.request()