我最近将环境从WSO2 IS 5.0.0更新为WSO2 IS 5.2.0。我的环境由部署在EC2 AWS实例上的一台计算机组成。我正在使用MySQL(不是默认的H2数据库)。部署IS的机器是Windows Server 2012 R2。
我使用密码授权类型为了获取特定用户的访问令牌,并且还存储了刷新令牌,以便在需要时能够发出另一个访问令牌。我做了下面的请求,以获得访问令牌:
POST
https://(IS-URL)/oauth2/token?scope=openif&grant_type=password&[email protected]@localhost.io&[email protected]@
配置适当的授权基本头
我才能发出新的访问令牌使用刷新令牌之后。例如:
POST
https://(IS-URL)/oauth2/token?scope=openid&grant_type=refresh_token&refresh_token=
配置适当的授权基本头
后,我执行从邮差几次最新帖子呼吁在2-5秒的时间间隔,第一5-7电话后,我开始收到以下错误响应:使用refresh_token时“提供授权许可无效”WSO2 IS 5.2.0
{
"error": "invalid_grant",
"error_description": "Provided Authorization Grant is invalid"
}
我期待着接受新的访问令牌,而是我收到上述错误提到。然后,我通过更新以下行modifiedthe log4j.properties:
log4j.logger.org.wso2.carbon.identity=DEBUG
log4j.logger.org.wso2.carbon.identity.application=DEBUG
log4j.logger.org.wso2.carbon.identity.mgt=DEBUG
log4j.logger.org.wso2.carbon.identity.oauth2=DEBUG
log4j.logger.org.wso2.carbon.identity.provisioning=DEBUG
log4j.logger.org.wso2.carbon.identity.user.account.association=DEBUG
log4j.logger.org.wso2.carbon.identity.user.profile.mgt=DEBUG
然后,我开始了IS,并试图再次上述方案提到的,这就是我在日志文件中收到:
[2016-11-15 21:29:18,873] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - Access Token request received for Client ID GCFfyPSGkykWG4zQTKoDp8NEvjIa, User ID null, Scope : [openid] and Grant Type : refresh_token
[2016-11-15 21:29:18,873] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.AbstractClientAuthHandler} - Can authenticate with client ID and Secret. Client ID: GCFfyPSGkykWG4zQTKoDp8NEvjIa
[2016-11-15 21:29:18,873] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.AbstractClientAuthHandler} - Grant type : refresh_token Strict client validation set to : null
[2016-11-15 21:29:18,873] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - Client credentials were available in the cache for client id : GCFfyPSGkykWG4zQTKoDp8NEvjIa
[2016-11-15 21:29:18,873] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - Successfully authenticated the client with client id : GCFfyPSGkykWG4zQTKoDp8NEvjIa
[2016-11-15 21:29:18,873] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.RefreshGrantHandler} - Access Token is not in 'ACTIVE' or 'EXPIRED' state for Client with Client Id : GCFfyPSGkykWG4zQTKoDp8NEvjIa
[2016-11-15 21:29:18,873] DEBUG {org.wso2.carbon.identity.oauth2.token.AccessTokenIssuer} - Invalid Grant provided by the client Id: GCFfyPSGkykWG4zQTKoDp8NEvjIa
[2016-11-15 21:29:18,873] DEBUG {org.wso2.carbon.identity.oauth2.token.AccessTokenIssuer} - OAuth-Error-Code=invalid_grant client-id=GCFfyPSGkykWG4zQTKoDp8NEvjIa grant-type=refresh_token scope=openid
对于更多的信息,请看看整个日志文件:
https://www.dropbox.com/s/ygfc9hrrgxjkzkh/console.log?dl=0
有人遇到类似的问题,这可能是在IS的错误或它是由某种错误配置引起的?
我看了一眼Refresh token returns invalid grant type,但无法找到问题的直接答案。
只想提一下,我尝试每秒发出一个请求,并尝试了5分钟的时间间隔,并且无法重现该问题。当请求频率足够高时,似乎会发生这种情况。
在此先感谢。
OAuthProblemException {error ='invalid_request' {}}您发送刷新令牌的请求有问题吗? – farasath
我发送完全相同的请求,并且可以多次执行并且在短时间内执行同一请求(例如,10秒2-5秒的请求)时突然开始返回“错误”:“invalid_grant”。我不认为请求有什么问题,因为每次都是一样的。我可以在刷新令牌时使用以下配置: false RenewRefreshTokenForRefreshGrant> –