microsoft / PowerShellForGitHub

Microsoft PowerShell wrapper for GitHub API
Other
582 stars 184 forks source link

Add support for authentication with JWT #405

Open ChristopherCapito opened 1 year ago

ChristopherCapito commented 1 year ago

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?

HowardWolosky commented 1 year ago

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).

ChristopherCapito commented 1 year ago

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.