/** * Get user name from Google, by the code provided. * @param token Google access token * @return The user found in Google * @throws IOException If fails */ private Identity fetch(final String token) throws IOException { final URI uri = UriBuilder .fromPath("https://www.googleapis.com/oauth2/v1/userinfo") .queryParam("alt", "json") .queryParam("access_token", "{token}") .build(token); return this.parse( new JdkRequest(uri).fetch() .as(JsonResponse.class).json() .readObject() ); }