Skip to content

401 when trying to extract GHUser#type #1816

Closed
@Haarolean

Description

@Haarolean

Hi, a code like this

new GitHubBuilder()
        .withJwtToken("token")
        .build()
        .getApp()
        .getInstallationById(githubInstallationId)
        .getAccount()
        .getType()

leads to 401:

Caused by: org.kohsuke.github.HttpException: {"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}
	at org.kohsuke.github.GitHubConnectorResponseErrorHandler$1.onError(GitHubConnectorResponseErrorHandler.java:62) ~[github-api-unbridged-1.318.jar:na]

There are a few issues here:

  1. The field is already initialized as "Organization" after calling getAccount(), so populating here is not necessary, perhaps.
  2. installation.getAccount().getUrl() returns https://api.github.com/users/<ORGANIZATION_LOGIN>, which perhaps is invalid, because it's an organization, not a user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions