All Projects → weibeu → Flask-Discord

weibeu / Flask-Discord

Licence: MIT License
Discord OAuth2 extension for Flask. An Easier implementation of "Log In With Discord".

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Flask-Discord

starlette-discord
"Login with Discord" support for Starlette and FastAPI
Stars: ✭ 15 (-87.8%)
Mutual labels:  oauth2, discord-oauth2-extension
SampleOAuth2 UsingPythonClient
Django Sample app using Python OAuth client
Stars: ✭ 23 (-81.3%)
Mutual labels:  oauth2
KeyManager
Android application to manage SSH and GPG keys on GitHub written in Kotlin.
Stars: ✭ 15 (-87.8%)
Mutual labels:  oauth2
react-native-oauth-login-tutorial
Learn how to log users into React Native apps via Facebook or Google OAuth
Stars: ✭ 56 (-54.47%)
Mutual labels:  oauth2
SimpleOAuth
Simple OAuth 2.0 for Android
Stars: ✭ 15 (-87.8%)
Mutual labels:  oauth2
brauzie
Awesome CLI for fetching JWT tokens for OAuth2.0 clients
Stars: ✭ 14 (-88.62%)
Mutual labels:  oauth2
SampleApp-QuickBooksV3API-Python
Python3 sample app demonstrates how to use Quickbooks API using Flask
Stars: ✭ 38 (-69.11%)
Mutual labels:  oauth2
inventory-demo
a simple MERN stack CRUD app example
Stars: ✭ 15 (-87.8%)
Mutual labels:  oauth2
contact-center
一个基于 Spring Cloud 的微服务客服系统
Stars: ✭ 15 (-87.8%)
Mutual labels:  oauth2
elm-oauth2
OAuth 2.0 client-side utils in Elm
Stars: ✭ 74 (-39.84%)
Mutual labels:  oauth2
Perfect-Authentication
OAuth2 Implementations with Facebook, Google, LinkedIn, Slack, SalesForce and GitHub providers.
Stars: ✭ 14 (-88.62%)
Mutual labels:  oauth2
django-todo
A simple todo list REST JSON backend with OAuth2
Stars: ✭ 45 (-63.41%)
Mutual labels:  oauth2
OpenAM
OpenAM is an open access management solution that includes Authentication, SSO, Authorization, Federation, Entitlements and Web Services Security.
Stars: ✭ 476 (+286.99%)
Mutual labels:  oauth2
bitnami-docker-oauth2-proxy
Bitnami Docker Image for OAuth2 Proxy
Stars: ✭ 42 (-65.85%)
Mutual labels:  oauth2
angular2-social-login
Angular 2 OAuth social login facebook, google, LinkedIn etc using NodeJS server
Stars: ✭ 40 (-67.48%)
Mutual labels:  oauth2
griffin-app-opensource
The Axway Griffin App goes open source!
Stars: ✭ 19 (-84.55%)
Mutual labels:  oauth2
spring-boot-oauth2-password-flow
Spring Boot 2 - OAuth2 password-flow with JWT
Stars: ✭ 51 (-58.54%)
Mutual labels:  oauth2
youtube-deno
A Deno client library of the YouTube Data API.
Stars: ✭ 30 (-75.61%)
Mutual labels:  oauth2
GITGET
GitHub의 Contributions를 iOS의 Widget으로 보여주는 App
Stars: ✭ 101 (-17.89%)
Mutual labels:  oauth2
werther
An Identity Provider for ORY Hydra over LDAP
Stars: ✭ 103 (-16.26%)
Mutual labels:  oauth2

Flask-Discord

PyPI Read the Docs Discord

Discord OAuth2 extension for Flask.

Installation

To install current latest release you can use following command:

python3 -m pip install Flask-Discord

Basic Example

import os

from flask import Flask, redirect, url_for
from flask_discord import DiscordOAuth2Session, requires_authorization, Unauthorized

app = Flask(__name__)

app.secret_key = b"random bytes representing flask secret key"
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "true"      # !! Only in development environment.

app.config["DISCORD_CLIENT_ID"] = 490732332240863233    # Discord client ID.
app.config["DISCORD_CLIENT_SECRET"] = ""                # Discord client secret.
app.config["DISCORD_REDIRECT_URI"] = ""                 # URL to your callback endpoint.
app.config["DISCORD_BOT_TOKEN"] = ""                    # Required to access BOT resources.

discord = DiscordOAuth2Session(app)


@app.route("/login/")
def login():
    return discord.create_session()
	

@app.route("/callback/")
def callback():
    discord.callback()
    return redirect(url_for(".me"))


@app.errorhandler(Unauthorized)
def redirect_unauthorized(e):
    return redirect(url_for("login"))

	
@app.route("/me/")
@requires_authorization
def me():
    user = discord.fetch_user()
    return f"""
    <html>
        <head>
            <title>{user.name}</title>
        </head>
        <body>
            <img src='{user.avatar_url}' />
        </body>
    </html>"""


if __name__ == "__main__":
    app.run()

For an example to the working application, check test_app.py

Requirements

  • Flask
  • requests_oauthlib
  • cachetools
  • discord.py

Documentation

Head over to documentation for full API reference.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].