AnswerDotAI / AnswerDotAI/ghapi

`jwt_token` not accurately named

Offen
#181 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
686
Forks
69
Ø Merge
1 Min.
Gemergte PRs (30 T.)
2

Beschreibung

In the constructor for a `GhApi` object, the `jwt_token` parameter appears to be used as a bearer token, whereas the `token` parameter uses an `Authorization: token` prefix:

https://github.com/fastai/ghapi/blob/4fe9459c7e7bd631c7317eaa9d2365f14f2cb34d/ghapi/core.py#L96-L101

There are other types of bearer tokens apart from JWTs. In the app space, [installation access tokens](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation#authenticating-with-an-installation-access-token) are also passed via a `Bearer` header, but are not JWTs. These look more like PATs, starting with `ghs_`.

I might recommend:

- clarifying the documentation on different ways to authenticate to the GitHub API, or pointing at the appropriate GitHub docs.
- rename the current `jwt_token` arg to something like `bearer_token`
- raise a non-fatal warning when `jwt_token` is specified, asking developers to use the appropriately-named `bearer_token` arg.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne in ghapi/core.py bei den Zeilen 96-101 und verfolge, wie die Authentifizierungsargumente des GhApi-Konstruktors dokumentiert und verwendet werden. Vergleiche die Terminologie mit der verknüpften GitHub-Dokumentation zu Installation-Tokens; als erledigt gilt die Aufgabe, wenn die ausgewählte Benennung, der Kompatibilitätshinweis und die Hinweise zur Authentifizierung konsistent berücksichtigt sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api, authentication
Issue-Typ
Refactoring
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.