Skip to main content

A pycord extension for Discord OAuth2 authentication in Quart applications.

Project description

pycord-quart

A pycord extension for Discord OAuth2 authentication in Quart applications.

Installation

Python >= 3.10.x is required.

# Windows
pip install --upgrade pycord-quart

# Linux
pip3 install --upgrade pycord-quart

Examples

from quart import Quart, request, session, redirect, url_for, jsonify
from pycord.ipc import Client
from pycord.quart import DiscordAuth, require_auth, get_current_user

app = Quart(__name__)
ipc_client = Client(secret_key=<"your IPCSecret">, host=<"your IPC Server IP">, port=<"your IPC Server Port">)

app.config["SECRET_KEY"] = <"your SecretKey">

discord_auth = DiscordAuth(
    client_id=<"your DiscordClientID">,
    client_secret=<"your DiscordClientSecret">,
    redirect_uri=<"your DiscordRedirectURI">,
    scopes=['identify', 'email', 'guilds'],
)

@app.route("/api/auth/login", methods=["GET"])
async def api_login():
    response = await discord_auth.login_handler()
    
    return jsonify(response.to_json), response.code

@app.route("/api/auth/callback", methods=["GET"])
async def api_callback():
    response = await discord_auth.callback_handler()

    return jsonify(response.to_json), response.code

@app.route("/api/auth/logout", methods=["POST"])
async def api_logout():
    response = await discord_auth.logout_handler()

    return jsonify(response.to_json), response.code

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080, debug=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycord_quart-0.1.4.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycord_quart-0.1.4-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file pycord_quart-0.1.4.tar.gz.

File metadata

  • Download URL: pycord_quart-0.1.4.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycord_quart-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1f3e996fa724d0eb196fcf255fa80e036ce2fb89a970be81dff9a59e15f4b7a3
MD5 807efef187b6fbdca214703412f0871e
BLAKE2b-256 6e5670f05c38f75a959c5b84558dea9e810dabc800e80ef33f4fb8ad78704023

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycord_quart-0.1.4.tar.gz:

Publisher: publish.yml on ParrotXray/pycord-quart

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycord_quart-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pycord_quart-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycord_quart-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 48f6cf3a09aa476ed3b65f3f9d700fb23614a6e7f6fa13497456f2bb00d42367
MD5 b5281f1371ce177ae1c99999a0c9e4ad
BLAKE2b-256 dea95294bc0eb1048d66b6f23a321584cd098e6d3757d9e7d1ce84de066951d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycord_quart-0.1.4-py3-none-any.whl:

Publisher: publish.yml on ParrotXray/pycord-quart

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page