Skip to content

🚀[Feature] Support GitHub Installation tokens #83

@Manbearpiet

Description

@Manbearpiet

GitHub Apps

We use GitHub Apps to automate actions on the GitHub platform. By creating a JWT, we authenticate to GitHub and request an installation token that functions the same as a PAT for that specific organization that installed the GitHub App.

When we use it for authentication we run into the following errors:

connect-gitHubAccount -AccessToken -Silent -Owner WeAreInSpark
! Enter your personal access token: ****************************************
Write-Warning: A parameter cannot be found that matches parameter name 'ForegroundColor'.
WARNING: Unexpected access token format: ghs_*
Invoke-GitHubAPI:
Invoke-GitHubAPI: ----------------------------------
Invoke-GitHubAPI:
Invoke-GitHubAPI: Request:
Invoke-GitHubAPI:
Invoke-GitHubAPI: StatusCodeVariable      : APICallStatusCode
Invoke-GitHubAPI: Method                  : 1
Invoke-GitHubAPI: ContentType             : application/vnd.github+json; charset=utf-8
Invoke-GitHubAPI: Authentication          : Bearer
Invoke-GitHubAPI: FollowRelLink           : True
Invoke-GitHubAPI: HttpVersion             : @{Major=2; Minor=0; Build=-1; Revision=-1; MajorRevision=-1; MinorRevision=-1}
Invoke-GitHubAPI: ResponseHeadersVariable : APICallResponseHeaders
Invoke-GitHubAPI: Token                   : @{Length=40}
Invoke-GitHubAPI: Uri                     : https://api.github.com/user
Invoke-GitHubAPI: Headers                 : @{Accept=application/vnd.github+json; charset=utf-8; X-GitHub-Api-Version=2022-11-28}
Invoke-GitHubAPI:
Invoke-GitHubAPI:
Invoke-GitHubAPI: ----------------------------------
Invoke-GitHubAPI:
Invoke-GitHubAPI: Message:
Invoke-GitHubAPI: Response status code does not indicate success: 403 (Forbidden).
Invoke-GitHubAPI:
Invoke-GitHubAPI: ----------------------------------
Invoke-GitHubAPI:
Invoke-GitHubAPI: Response:
Invoke-GitHubAPI:
Invoke-GitHubAPI: Version             : @{Major=2; Minor=0; Build=-1; Revision=-1; MajorRevision=-1; MinorRevision=-1}
Invoke-GitHubAPI: Content             : @{Headers=System.Object[]}
Invoke-GitHubAPI: StatusCode          : 403
Invoke-GitHubAPI: ReasonPhrase        : Forbidden
Invoke-GitHubAPI: Headers             : {@{Key=Server; Value=System.Object[]}, @{Key=Date; Value=System.Object[]}, @{Key=x-github-media-type;
Value=System.Object[]}, @{Key=x-github-api-version-selected; Value=System.Object[]}…}
Invoke-GitHubAPI: TrailingHeaders     : {}
Invoke-GitHubAPI: RequestMessage      : @{Version=; VersionPolicy=0; Content=; Method=; RequestUri=https://api.github.com/user; Headers=System.Object[];
Properties=System.Object[]; Options=System.Object[]}
Invoke-GitHubAPI: IsSuccessStatusCode : False
Invoke-GitHubAPI:
Invoke-GitHubAPI:
Invoke-GitHubAPI: ----------------------------------
Invoke-GitHubAPI:
Invoke-GitHubAPI:
Exception: Response status code does not indicate success: 403 (Forbidden).

It's a shame because it works like a breeze.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions