我遵循https://github.com/openid/AppAuth-Android来实现使用Appauth的Keycloak登录。我有时在尝试请求令牌时收到AuthorizationException:{“类型”:0,“代码”:3,“errorDescription”:“网络错误”}。有时它工作得很好,我得到了响应。我在网上搜索,也找不到解决方案。有人知道解决方案吗?
我使用了以下代码来获取令牌
authService.performTokenRequest(
resp.createTokenExchangeRequest(),
new AuthorizationService.TokenResponseCallback() {
@Override public void onTokenRequestCompleted(
TokenResponse resp, AuthorizationException ex) {
if (resp != null) {
// exchange succeeded
} else {
// authorization failed, check ex for more details
}
}
});谢谢。
发布于 2021-11-04 19:52:13
您的代码看起来没问题,类似于this code of mine。
失败的消息应该类似于step 10 of my blog post。当我遇到这样的问题时,我会继续跟踪HTTPS消息,以便更好地了解原因。博客文章的第7步链接到HTTPS跟踪设置,以防有帮助。
https://stackoverflow.com/questions/69816752
复制相似问题