public GitHubUser getUser()

in src/main/java/org/jetbrains/teamcity/githubauth/GitHubOAuthClient.java [52:64]


    public GitHubUser getUser(@NotNull String token) {
        HttpHeaders headers = new HttpHeaders();
        headers.setAccept(singletonList(MediaType.APPLICATION_JSON));
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        headers.set("Authorization", "token " + token);
        HttpEntity<String> request = new HttpEntity<>(headers);

        try {
            return restTemplate.exchange("https://api.github.com/user", HttpMethod.GET, request, GitHubUser.class).getBody();
        } catch (RestClientException e) {
            throw new GitHubLoginException("Error obtaining GitHub user", e);
        }
    }