} catch (OAuthServiceException ex) {
return super.createErrorResponseFromBean(ex.getError());
}
// Find the grant handler
AccessTokenGrantHandler handler = findGrantHandler(params);
if (handler == null) {
return createErrorResponse(params, OAuthConstants.UNSUPPORTED_GRANT_TYPE);
}
// Create the access token
ServerAccessToken serverToken = null;
try {
serverToken = handler.createAccessToken(client, params);
} catch (OAuthServiceException ex) {
return handleException(ex, OAuthConstants.INVALID_GRANT);
}
if (serverToken == null) {
return createErrorResponse(params, OAuthConstants.INVALID_GRANT);