spotify/github-java-client

Support a way to only generate access tokens from installation

patricioperezv opened this issue · 1 comments

Hi, i'm playing with a use case in which i need to get an access token from a github application (appid and installation id), this access token is used to clone a repo, so i don't really need any more actions to be done on the github api (Besides getting the access token), i would really like to use this library for that purpose, is it possible?
I tried the following:

GitHubClient hubClient = GitHubClient.create(
    URI.create(GITHUB_ENDPOINT),
    new File(pemLocation),
    applicationId,
    installationId
);

SearchClient searchClient = hubClient.createSearchClient();
searchClient.users(ImmutableSearchParameters.builder().q("dumbdumb").build());

Optional<String> accessToken = hubClient.getAccessToken();

But the access token doesn't get populated

Hey, I don't think the Access Token is generated without making any request, so calling getAccessToken() will fail. The access token is generated here in case this helps you.