OAuthProblemException - description='AADSTS900144:请求正文必须包含以下参数:'refresh_token'
OAuthProblemException - description='AADSTS900144: The request body must contain the following parameter: 'refresh_token'
这是我的 MS 团队身份验证提供商代码:
try {
if (durationPassed >= integrationToken.getAuth().getExpiresIn() * 1000) {
TokenRequestBuilder token = OAuthClientRequest.tokenLocation(AuthHelper.getAuthority() + AuthConstants.TOKEN_ENDPOINT)
.setClientId(AuthHelper.getClientId()).setScope(AuthHelper.getScopes())
.setRefreshToken(integrationToken.getAuth().getRefreshToken())
.setGrantType(GrantType.REFRESH_TOKEN).setClientSecret(AuthHelper.getClientSecret())
.setRedirectURI(authHelper.getRedirectUrl());
OAuthClientRequest request = token.buildBodyMessage();
OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
long startTime = System.currentTimeMillis();
OAuthJSONAccessTokenResponse response = oAuthClient.accessToken(request);
saveNewTokenData(integrationToken, response, startTime);
}
return integrationToken.getAuth().getAccessToken();
} catch (Exception e) {
e.printStackTrace();
}
我收到这个错误:
OAuthProblemException{error='invalid_request', description='AADSTS900144: The request body must contain the following parameter: 'refresh_token'.
Trace ID: 89433eff-047a-476c-92d0-fcf61e7fa100
Correlation ID: 87f28fa7-729f-4c92-8457-3b3d1eb2df45
Timestamp: 2021-07-16 06:01:31Z', uri='https://login.microsoftonline.com/error?code=900144', state='null', scope='null', redirectUri='null', responseStatus=400, parameters={}}
at org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:59)
at org.apache.oltu.oauth2.client.validator.OAuthClientValidator.validateErrorResponse(OAuthClientValidator.java:63)
at org.apache.oltu.oauth2.client.validator.OAuthClientValidator.validate(OAuthClientValidator.java:48)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.validate(OAuthClientResponse.java:127)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:96)
at org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:65)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:101)
at org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:60)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:120)
at org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory.createCustomResponse(OAuthClientResponseFactory.java:82)
at org.apache.oltu.oauth2.client.URLConnectionClient.execute(URLConnectionClient.java:111)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:65)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:55)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:71)
at com.ps.addons.chats.teams.auth.provider.TeamAuthenticationProvider.getAccessToken(TeamAuthenticationProvider.java:59)
at com.ps.addons.chats.teams.auth.provider.TeamAuthenticationProvider.authenticateRequest(TeamAuthenticationProvider.java:31)
at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:395)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:220)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:200)
at com.microsoft.graph.http.BaseCollectionRequest.send(BaseCollectionRequest.java:92)
at com.microsoft.graph.requests.extensions.UserCollectionRequest.get(UserCollectionRequest.java:76)
at com.ps.addons.chats.teams.graphql.loader.UserBatchLoader.lambda$load(UserBatchLoader.java:33)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
at java.lang.Thread.run(Thread.java:748)
请帮忙。我缺少一些范围吗?
Clearing and regenerating the integration token from our authentication setup which was being used to feed the refresh_token for the ms request worked. - Aakash Verma
这是我的 MS 团队身份验证提供商代码:
try {
if (durationPassed >= integrationToken.getAuth().getExpiresIn() * 1000) {
TokenRequestBuilder token = OAuthClientRequest.tokenLocation(AuthHelper.getAuthority() + AuthConstants.TOKEN_ENDPOINT)
.setClientId(AuthHelper.getClientId()).setScope(AuthHelper.getScopes())
.setRefreshToken(integrationToken.getAuth().getRefreshToken())
.setGrantType(GrantType.REFRESH_TOKEN).setClientSecret(AuthHelper.getClientSecret())
.setRedirectURI(authHelper.getRedirectUrl());
OAuthClientRequest request = token.buildBodyMessage();
OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
long startTime = System.currentTimeMillis();
OAuthJSONAccessTokenResponse response = oAuthClient.accessToken(request);
saveNewTokenData(integrationToken, response, startTime);
}
return integrationToken.getAuth().getAccessToken();
} catch (Exception e) {
e.printStackTrace();
}
我收到这个错误:
OAuthProblemException{error='invalid_request', description='AADSTS900144: The request body must contain the following parameter: 'refresh_token'.
Trace ID: 89433eff-047a-476c-92d0-fcf61e7fa100
Correlation ID: 87f28fa7-729f-4c92-8457-3b3d1eb2df45
Timestamp: 2021-07-16 06:01:31Z', uri='https://login.microsoftonline.com/error?code=900144', state='null', scope='null', redirectUri='null', responseStatus=400, parameters={}}
at org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:59)
at org.apache.oltu.oauth2.client.validator.OAuthClientValidator.validateErrorResponse(OAuthClientValidator.java:63)
at org.apache.oltu.oauth2.client.validator.OAuthClientValidator.validate(OAuthClientValidator.java:48)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.validate(OAuthClientResponse.java:127)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:96)
at org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:65)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:101)
at org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:60)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:120)
at org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory.createCustomResponse(OAuthClientResponseFactory.java:82)
at org.apache.oltu.oauth2.client.URLConnectionClient.execute(URLConnectionClient.java:111)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:65)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:55)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:71)
at com.ps.addons.chats.teams.auth.provider.TeamAuthenticationProvider.getAccessToken(TeamAuthenticationProvider.java:59)
at com.ps.addons.chats.teams.auth.provider.TeamAuthenticationProvider.authenticateRequest(TeamAuthenticationProvider.java:31)
at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:395)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:220)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:200)
at com.microsoft.graph.http.BaseCollectionRequest.send(BaseCollectionRequest.java:92)
at com.microsoft.graph.requests.extensions.UserCollectionRequest.get(UserCollectionRequest.java:76)
at com.ps.addons.chats.teams.graphql.loader.UserBatchLoader.lambda$load(UserBatchLoader.java:33)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
at java.lang.Thread.run(Thread.java:748)
请帮忙。我缺少一些范围吗?
Clearing and regenerating the integration token from our authentication setup which was being used to feed the refresh_token for the ms request worked. - Aakash Verma