PowerShellForGitHub icon indicating copy to clipboard operation
PowerShellForGitHub copied to clipboard

Add support for authentication with JWT

Open ChristopherCapito opened this issue 1 year ago • 2 comments

A description of your problem or question

Greetings

First of all: Great job getting portion of the API working. I just encountered an issue today where this could have been helpful. Although I wonder how this pans out for large-scale automations where the token limit of 5000 will be hit (just had such a case today).

Is it possible to also use a GitHub App AccessToken? I know that in order to get that we need a signed JWT, but that could be accomplished with PowerShell I think, provided we provide a certificate.

Alternatively, is it possible to provide my own Bearer Token?

ChristopherCapito avatar Apr 19 '23 23:04 ChristopherCapito

Is it possible to also use a GitHub App AccessToken? I know that in order to get that we need a signed JWT, but that could be accomplished with PowerShell I think, provided we provide a certificate.

This project doesn't currently support that, but I'm totally open to submissions to add that support.

Alternatively, is it possible to provide my own Bearer Token?

At the moment, no. Here you can see how we compose the Authorization header:

https://github.com/microsoft/PowerShellForGitHub/blob/516be0b4cafafb334bca5951c057af0885e6976f/GitHubCore.ps1#L250-L254

This uses the token syntax as opposed to the Bearer syntax (which a JWT would require).

HowardWolosky avatar Apr 20 '23 18:04 HowardWolosky

Understood. Yeah I noticed some functionality I would need is missing from the API implementation as well. I ll see what I can contribute once I have finished my work.

ChristopherCapito avatar Apr 21 '23 13:04 ChristopherCapito