我有一个应用程序,该应用程序的身份验证令牌每12小时失效一次,并且当令牌有效时,OAuth拦截器将拦截每个网络调用,但一切正常,但是当令牌过期时,一切都会出错。
我执行网络调用,如果令牌有效,则接收到有效结果,但是当令牌过期时,它将检测到令牌无效,因此拦截器调用refreshToken sync API,该API返回StackOverflowError,因为请求为被无限调用而不必等待结果被接收
override fun intercept(chain: Interceptor.Chain): Response? {
// handle token expiration
if (hasTokenExpired()) {
Log.wtf("TenantInterceptor", "[Token test] -> token expired, refreshing...")
val result = refreshToken()
if (!result.isSuccessful) {
Log.wtf("TenantInterceptor", "[Token test] -> failed to refresh bearer !")
// failed to refresh token
return unauthorizedResponse(chain)
}
Log.wtf("TenantInterceptor", "[Token test] -> token bearer refreshed")
}
var response = performRequest(chain)
// handle token rejection
if (isTokenRejected(response)) {
Log.wtf("TenantInterceptor", "[Token test] -> request re-rejected, refreshing...")
val result = refreshToken()
if (!result.isSuccessful) {
Log.wtf("TenantInterceptor", "[Token test] -> failed to refresh bearer")
// failed to refresh token
return unauthorizedResponse(chain)
} else {
Log.wtf("TenantInterceptor", "[Token test] -> token refreshed, re-performing request")
response = performRequest(chain)
}
}
return response
}
我的刷新令牌功能也在这里:
fun refreshToken(): retrofit2.Response<AccessTokenResponse> {
val result = ServicesFactory.getOAuthService().refreshToken(
Constants.APIConstants.CLIENT_ID,
Constants.APIConstants.CLIENT_SECRET,
getRefreshToken(),
ActivationUtilities.getTenantIdentifier(context),
ActivationUtilities.getDeviceGUID(context),
Constants.APIConstants.GRANT_TYPE_PASSWORD
).executeSync()
if (result.isSuccessful) {
result.body()?.let { at -> AccessTokenUtilities.setAccessToken(context, at) }
}
return result
}
这是我的原木猫
2019-07-04 11:35:26.380 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.388 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.393 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.399 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.405 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.410 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.416 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.422 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.428 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.434 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.440 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.446 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.453 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.462 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.470 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.477 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.484 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.490 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.497 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.503 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.511 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.520 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.527 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.535 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.542 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.550 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.560 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.567 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.575 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.584 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.593 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.602 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.611 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.621 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.630 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.640 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.651 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.664 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.675 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.687 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.700 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.716 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.732 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.745 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.758 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.769 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.786 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.797 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.807 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.822 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.835 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.848 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.859 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.881 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.892 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.904 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.924 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.943 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.958 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.971 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.984 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:26.998 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.010 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.026 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.050 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.064 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.078 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.089 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.105 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.120 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.135 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.151 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.171 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.185 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.204 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.220 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.234 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.327 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.367 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.408 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.450 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.510 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.542 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.571 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.593 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.611 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.629 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.648 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.670 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.692 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.709 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.728 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.747 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.765 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.782 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
2019-07-04 11:35:27.799 15346-15447/com.cme.daycarechannelparentdev.daycarechannel E/TenantInterceptor: [Token test] -> token expired, refreshing...
io.reactivex.exceptions.UndeliverableException: java.lang.StackOverflowError: stack size 1037KB
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:776)
Caused by: java.lang.StackOverflowError: stack size 1037KB
at com.google.gson.internal.ConstructorConstructor.get(ConstructorConstructor.java:56)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:99)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at retrofit2.converter.gson.GsonConverterFactory.responseBodyConverter(GsonConverterFactory.java:64)
at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:330)
at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:313)
at retrofit2.ServiceMethod$Builder.createResponseConverter(ServiceMethod.java:739)
at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:172)
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:170)
at retrofit2.Retrofit$1.invoke(Retrofit.java:147)
at java.lang.reflect.Proxy.invoke(Proxy.java:813)
at $Proxy10.refreshToken(Unknown Source)
at com.cme.daycarechannelparent.Api.interceptors.OAuthInterceptor.refreshToken(OAuthInterceptor.kt:109)
at com.cme.daycarechannelparent.Api.interceptors.OAuthInterceptor.intercept(OAuthInterceptor.kt:26)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:223)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
at okhttp3.RealCall.execute(RealCall.java:81)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:91)
at com.cme.daycarechanne.CallExtensionsKt.executeSync(CallExtensions.kt:22)
at com.cme.daycarechannelparent.Api.interceptors.OAuthInterceptor.refreshToken(OAuthInterceptor.kt:116)
at com.cme.daycarechannelparent.Api.interceptors.OAuthInterceptor.intercept(OAuthInterceptor.kt:26)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:223)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
at okhttp3.RealCall.execute(RealCall.java:81)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:91)
at com.cme.daycarechanne.CallExtensionsKt.executeSync(CallExtensions.kt:22)
at com.cme.daycarechannelparent.Api.interceptors.OAuthInterceptor.refreshToken(OAuthInterceptor.kt:116)
at com.cme.daycarechannelparent.Api.interceptors.OAuthInterceptor.intercept(OAuthInterceptor.kt:26)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
2019-07-04 10:24:01.596 4889-5002/com.cme.daycarechannelparentdev.daycarechannel E/AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:223)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
at okhttp3.RealCall.execute(RealCall.java:81)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:91)
at com.cme.daycarechanne.CallExtensionsKt.executeSync(CallExtensions.kt:22)
at com.cme.daycarechannelparent.Api.interceptors.OAuthInterceptor.refreshToken(OAuthInterceptor.kt:116)
at com.cme.daycarechannelparent.Api.interceptors.OAuthInterceptor.intercept(OAuthInterceptor.kt:26)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:223)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
at okhttp3.RealCall.execute(RealCall.java:81)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
我希望令牌可以刷新并有新的请求,但是由于无限的API调用,我的应用崩溃了
答案 0 :(得分:0)
刷新令牌功能位于具有auth拦截器的服务中,因此存在无限的拦截链。将刷新令牌移至没有拦截器的服务即可解决问题