gh-auth
A simple Python library for web-based GitHub authentication using the device flow.
Installation
pip install gh-auth
Usage
-
On GitHub, create a GitHub or OAuth app.
-
In your code, import the
authenticate_with_github()function and pass it your app's client ID.
from gh_auth import authenticate_with_github
authenticate_with_github(client_id)
That's it.
When called, the function will prompt users to visit https://github.com/login/device and enter an eight-character code, then continously ping GitHub for a response. Upon sucessful authentication, the function will return a token you can use to interact with the GitHub API via libraries such as PyGithub.
Scopes
If you're using an OAuth app, you'll probably also want to define what scopes you want your app to be granted. Simply pass
a list of scopes into the authenticate_with_github() function alongside your client ID, like so:
authenticate_with_github(client_id, scopes=["example_scope", "another_scope"])
See a full list of available OAuth scopes here.
If you're using an OAuth app and don't define any scopes, GitHub will default to granting it read-only access to the public data associated with the account being authenticated and nothing more. (For GitHub apps, scopes are defined on GitHub and can't be changed from this module.)
License
gh-auth's source code is released under the MIT License.
Metadata
Release files for gh-auth 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gh_auth-0.1.3.tar.gz | 3.2 kB | Without provenance | Details for gh_auth-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gh_auth-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for gh_auth-0.1.3-py3-none-any.whl |
Total release size: 6.6 kB
Release files / gh_auth-0.1.3.tar.gz
| Download URL | gh_auth-0.1.3.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
545a4719c7c805e3d15451ac0d788dd2865e63908a7ef78045204ffbf91b5a2d
|
|
BLAKE2b-256 checksum How to use checksums |
21f5b9f910d7f1baf409b50da672ad765f6a6c649f4a25a8c08f8e91f3aa58ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Windows/10
|
Release files / gh_auth-0.1.3-py3-none-any.whl
| Download URL | gh_auth-0.1.3-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a2c9748bae7fa38b53af5889f075345364b25816b8c843c49b014de61248376
|
|
BLAKE2b-256 checksum How to use checksums |
defe6db6d3ef4e780c5fa68f1bddf7ae85b55eea58ccc0a1cb23aac40695315f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Windows/10
|
Security for gh-auth 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.