use of com.alipay.api.request.AlipaySystemOauthTokenRequest in project dq-easy-cloud by dq-open-cloud.
the class EcZfbOauthToken method doGetOauthAccessToken.
@Override
public Map<String, Object> doGetOauthAccessToken() throws Exception {
AlipaySystemOauthTokenRequest oauthTokenRequest = new AlipaySystemOauthTokenRequest();
oauthTokenRequest.setCode(super.authCode);
oauthTokenRequest.setGrantType(grantType);
AlipaySystemOauthTokenResponse oauthTokenResponse = alipayClient.execute(oauthTokenRequest);
EcAssert.verifyObjNull(oauthTokenResponse, "oauthTokenResponse");
if (oauthTokenResponse != null && oauthTokenResponse.isSuccess()) {
Map<String, Object> tokenRepParam = EcMapUtils.newHashMap();
tokenRepParam.put(EcOauthAccessToken.ACCESS_TOKEN, oauthTokenResponse.getAccessToken());
tokenRepParam.put(EcOauthAccessToken.EXPIRES_IN, oauthTokenResponse.getExpiresIn());
tokenRepParam.put(EcOauthAccessToken.REFRESH_TOKEN, oauthTokenResponse.getRefreshToken());
tokenRepParam.put(EcOauthAccessToken.AUTH_TOKEN_TYPE, oauthTokenResponse.getAuthTokenType());
tokenRepParam.put(EcOauthAccessToken.OPENID, oauthTokenResponse.getUserId());
tokenRepParam.put(EcOauthAccessToken.RE_EXPIRES_IN, oauthTokenResponse.getReExpiresIn());
return tokenRepParam;
} else {
throw new EcBaseBusinessException(oauthTokenResponse.getCode(), oauthTokenResponse.getMsg()).buildExceptionDetail(oauthTokenResponse);
}
}
Aggregations