"IO Error when obtaining tokenInfo: " + cause.getMessage(), cause);
}
}
};
Tokeninfo tokenInfo = googleRequest.executeRequest(accessTokenContext, this);
// If there was an error in the token info, abort.
if (tokenInfo.containsKey("error")) {
throw new OAuthException(OAuthExceptionCode.ACCESS_TOKEN_ERROR, "Error during token validation: " + tokenInfo.get("error").toString());
}
if (!tokenInfo.getIssuedTo().equals(clientID)) {
throw new OAuthException(OAuthExceptionCode.ACCESS_TOKEN_ERROR, "Token's client ID does not match app's. clientID from tokenINFO: " + tokenInfo.getIssuedTo());
}
if (log.isTraceEnabled()) {
log.trace("Successfully validated accessToken from google: " + tokenInfo);
}
String[] scopes = tokenInfo.getScope().split(" ");
return new GoogleAccessTokenContext(accessTokenContext.getTokenData(), scopes);
}