Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing a JWT as an authentication method #489

Open
thomasin opened this issue Jan 5, 2023 · 1 comment
Open

Allow passing a JWT as an authentication method #489

thomasin opened this issue Jan 5, 2023 · 1 comment

Comments

@thomasin
Copy link

thomasin commented Jan 5, 2023

Hello (: I'm using this library and have added a couple of unsupported endpoints locally, that I am hoping to make a PR for soon. However, some of them require the request passes a JWT instead of an OAuth token.

This library, when you use OAuth authorisation, sets the Authorisation header as Authorisation: token {token}.
However there is a note in the GitHub API docs that states:

Note: In most cases, you can use Authorization: Bearer or Authorization: token to pass a token. However, if you are passing a JSON web token (JWT), you must use Authorization: Bearer.

So it looks like allowing users to pass JWTs could be as simple as changing that token to Bearer (which would also be backwards compatible and so not require a major library version bump). However, it might be more explicit and user friendly to add a new JWT option to the GitHub.Auth sum type.

Hope this is all clear! Happy to open any needed PRs

NorfairKing pushed a commit to NorfairKing/github that referenced this issue Jul 16, 2023
@frasertweedale
Copy link

FWIW, at a glance it looks like you define a wrapper type for a JWT and define your own instance of AuthMethod. A mild inconvenience. I agree this library should adopt a JWT case of AuthMethod, as in #497. But I don't think the current lack of support is a hard blocker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants