You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I have an application that leverages both the Github v3 API (using https://github.com/google/go-github) and the v4 API for a number of Pull Request checks. Until recently I was using a personal access token in both libraries for authorization, but I recently switched to a GitHub App.
Here's a snippet of how I instantiate the clients:
// NewClient will generate a configured GitHub client for use.funcNewClient(ctx context.Context) *github.Client {
returngithub.NewClient(newGitHubAuth(&ctx))
}
// NewGraphClient will generate a configured GitHub client for use against the GraphQL API.funcNewGraphClient(ctx context.Context) *githubv4.Client {
returngithubv4.NewClient(newGitHubAuth(&ctx))
}
funcnewGitHubAuth(ctx*context.Context) *http.Client {
// GitHub App installationappPem:=os.Getenv("GITHUB_APP_PEM")
ifappPem!="" {
log.Debug("Pulling credentials for GitHub App")
itr, err:=ghinstallation.NewKeyFromFile(http.DefaultTransport, appID, appInstallationID, appPem)
iferr!=nil {
log.Warning(err)
}
return&http.Client{Transport: itr}
}
// Interactive run by a usertoken:=os.Getenv("GITHUB_TOKEN")
iftoken!="" {
log.Debug("Pulling credentials for GitHub Personal Access Token")
ts:=oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
returnoauth2.NewClient(*ctx, ts)
}
log.Error("Unable to find GitHub credentials from the GITHUB_APP_PEM or GITHUB_TOKEN environment variables")
return&http.Client{}
}
Shortly after deploying, the v4 client began throwing a number of could not refresh installation id ... received non 2xx response status errors from the underlying ghinstallation library...but only for the v4 library. The v3 library appears to have continued functioning.
I haven't read anything in this repository around recommended implementations of GitHub Apps. Is using ghinstallation supported? If so, any idea what may be happening?
The text was updated successfully, but these errors were encountered:
Currently I have an application that leverages both the Github v3 API (using https://github.com/google/go-github) and the v4 API for a number of Pull Request checks. Until recently I was using a personal access token in both libraries for authorization, but I recently switched to a GitHub App.
Here's a snippet of how I instantiate the clients:
Note that this is using the same https://github.com/bradleyfalzon/ghinstallation library for transport-based authentication as the v3 library is using.
Shortly after deploying, the v4 client began throwing a number of
could not refresh installation id ... received non 2xx response status
errors from the underlying ghinstallation library...but only for the v4 library. The v3 library appears to have continued functioning.I haven't read anything in this repository around recommended implementations of GitHub Apps. Is using ghinstallation supported? If so, any idea what may be happening?
The text was updated successfully, but these errors were encountered: