Starlette-Discord
"Login with Discord" support for Starlette and FastAPI
starlette-discord is a Discord OAuth2 module intended for use with Starlette and FastAPI.
Installing
starlette-discord can be installed with the command
# Linux
python3 -m pip install -U starlette-discord
# Windows
python -m pip install -U starlette-discord
To install the development version of the library directly from source:
$ git clone https://github.com/nwunderly/starlette-discord
$ cd starlette-discord
$ python3 -m pip install -U .
Quickstart
Below is an example FastAPI app implementing Discord's OAuth flow to identify the user.
import uvicorn
from fastapi import FastAPI
from starlette_discord import DiscordOAuthClient
client_id = "YOUR APP'S CLIENT ID HERE"
client_secret = "YOUR APP'S CLIENT SECRET HERE"
redirect_uri = "http://localhost:8000/callback"
app = FastAPI()
discord_client = DiscordOAuthClient(client_id, client_secret, redirect_uri)
@app.get('/login')
async def start_login():
return discord_client.redirect()
@app.get('/callback')
async def finish_login(code: str):
user = await discord_client.login(code)
print(user)
return user
uvicorn.run(app)
To begin the OAuth authorization flow with this app, visit http://localhost:8000/login.
Metadata
Release files for starlette-discord 0.2.1
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 |
|---|---|---|---|---|
| starlette-discord-0.2.1.tar.gz | 14.6 kB | Without provenance | Details for starlette-discord-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| starlette_discord-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for starlette_discord-0.2.1-py3-none-any.whl |
Total release size: 30.0 kB
Release files / starlette-discord-0.2.1.tar.gz
| Download URL | starlette-discord-0.2.1.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5af93c9da908b46aac81e7d1738e762bfb61ccc7c8409295942b19c62aa93e52
|
|
BLAKE2b-256 checksum How to use checksums |
6bac9b4cf856df57482fd1b67a1becf5be483f34101c4cc0aa09dab1d30a9aa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / starlette_discord-0.2.1-py3-none-any.whl
| Download URL | starlette_discord-0.2.1-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac1e0daf28f73daf195e3b0387e93ec187a4ce4c732349cc8a09eabc7bba7721
|
|
BLAKE2b-256 checksum How to use checksums |
f91deb54bc64e4e4d86725a662fa984831e577afdd17b23b43fe5477a01106c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Security for starlette-discord 0.2.1
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.