0
我使用google-oauth-java一两件事,我的生活真的变得复杂的是,当我尝试使用OAuthClient.invoke()
我经常得到OAuthProblemException
抛出由于请求返回正因为如此代码302,而不是200,我发现自己重写invoke
代码,并使用OAuthClient.access()
代替。我想知道我是否缺少某种类型的followRedirect
设置?文档不存在,例子也没有帮助,有人可以帮我吗?google-oauth-java如何处理重定向?
下面是从OAuthClient
片段阐述
public OAuthMessage invoke(OAuthMessage request, ParameterStyle style)
throws IOException, OAuthException {
OAuthResponseMessage response = access(request, style);
if ((response.getHttpResponse().getStatusCode()/100) != 2) {
OAuthProblemException problem = response.toOAuthProblemException();
try {
problem.setParameter(OAuthProblemException.SIGNATURE_BASE_STRING,
OAuthSignatureMethod.getBaseString(request));
} catch (Exception ignored) {
}
throw problem;
}
return response;
}