Authenticator not working Retrofit Android Studio

251 views Asked by At

When the call is made, retrofit doesn't jump into an authenticator. It's not called. Which could be the reason for ignoring Authenticator?

private val clientWithAuth by lazy {
    Retrofit.Builder().baseUrl(Config.API_URL)
        .client(
            OkHttpClient().newBuilder()
                .addInterceptor(AccessTokenInterceptor())
                .addInterceptor(
                    LoggingInterceptor.Builder()
                        .setLevel(Level.BODY)
                        .request("Request")
                        .response("Response")
                            .addHeader("Content-Type", "application/json").build()

                )
                .authenticator(AccesTokenAuthenticator())
                .build()
        ).addConverterFactory(GsonConverterFactory.create()).build().create(Api::class.java)
}
0

There are 0 answers