相关疑难解决方法(0)

Okhttp Authenticator多线程

OkHttp在我的Android应用程序中使用了几个异步请求.所有请求都需要使用标头发送令牌.有时我需要使用RefreshToken刷新令牌,所以我决定使用OkHttp's Authenticatorclass.

当两个或多个异步请求同时从服务器获得401响应代码时会发生什么?authenticate()是为每个请求调用Authenticator的方法,还是只为第一个获得401的请求调用一次?

@Override
public Request authenticate(Proxy proxy, Response response) throws IOException
{                
    return null;
}
Run Code Online (Sandbox Code Playgroud)

如何只刷新一次令牌?

authentication multithreading android okhttp

8
推荐指数
1
解决办法
1984
查看次数

标签 统计

android ×1

authentication ×1

multithreading ×1

okhttp ×1