{"id":25726707,"url":"https://github.com/weibeu/flask-discord","last_synced_at":"2025-04-07T15:08:54.304Z","repository":{"id":38477323,"uuid":"185177706","full_name":"weibeu/Flask-Discord","owner":"weibeu","description":"Discord OAuth2 extension for Flask. An Easier implementation of \"Log In With Discord\".","archived":false,"fork":false,"pushed_at":"2024-09-04T00:16:00.000Z","size":2270,"stargazers_count":182,"open_issues_count":11,"forks_count":48,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T12:07:28.247Z","etag":null,"topics":["dashboard","discord","discord-oauth2-extension","flask","flask-discord","flask-extension","oauth2","python"],"latest_commit_sha":null,"homepage":"https://flask-discord.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weibeu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.rst","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"__thecosmos","ko_fi":"thecosmos","custom":["https://paypal.me/thecosmoss/"]}},"created_at":"2019-05-06T10:48:29.000Z","updated_at":"2025-03-28T14:40:44.000Z","dependencies_parsed_at":"2024-06-18T16:57:21.065Z","dependency_job_id":"1de86880-6289-4e35-835c-0fe7b614dc54","html_url":"https://github.com/weibeu/Flask-Discord","commit_stats":{"total_commits":230,"total_committers":8,"mean_commits":28.75,"dds":0.08260869565217388,"last_synced_commit":"e5bda937d70ad35d30b0c7034151ed76cebf6bfc"},"previous_names":["thec0sm0s/flask-discord"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weibeu%2FFlask-Discord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weibeu%2FFlask-Discord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weibeu%2FFlask-Discord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weibeu%2FFlask-Discord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weibeu","download_url":"https://codeload.github.com/weibeu/Flask-Discord/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675597,"owners_count":20977376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dashboard","discord","discord-oauth2-extension","flask","flask-discord","flask-extension","oauth2","python"],"created_at":"2025-02-25T23:18:30.661Z","updated_at":"2025-04-07T15:08:54.277Z","avatar_url":"https://github.com/weibeu.png","language":"Python","funding_links":["https://patreon.com/__thecosmos","https://ko-fi.com/thecosmos","https://paypal.me/thecosmoss/"],"categories":[],"sub_categories":[],"readme":"# Flask-Discord\n[![PyPI](https://img.shields.io/pypi/v/Flask-Discord?style=for-the-badge)](https://pypi.org/project/Flask-Discord/) [![Read the Docs](https://img.shields.io/readthedocs/flask-discord?style=for-the-badge)](https://flask-discord.readthedocs.io/en/latest/) [![Discord](https://img.shields.io/discord/690878977920729177?label=Discord%20Community\u0026logo=Discord\u0026style=for-the-badge)](https://discord.gg/7CrQEyP)\n\nDiscord OAuth2 extension for Flask.\n\n\n### Installation\nTo install current latest release you can use following command:\n```sh\npython3 -m pip install Flask-Discord\n```\n\n\n### Basic Example\n```python\nimport os\n\nfrom flask import Flask, redirect, url_for\nfrom flask_discord import DiscordOAuth2Session, requires_authorization, Unauthorized\n\napp = Flask(__name__)\n\napp.secret_key = b\"random bytes representing flask secret key\"\nos.environ[\"OAUTHLIB_INSECURE_TRANSPORT\"] = \"true\"      # !! Only in development environment.\n\napp.config[\"DISCORD_CLIENT_ID\"] = 490732332240863233    # Discord client ID.\napp.config[\"DISCORD_CLIENT_SECRET\"] = \"\"                # Discord client secret.\napp.config[\"DISCORD_REDIRECT_URI\"] = \"\"                 # URL to your callback endpoint.\napp.config[\"DISCORD_BOT_TOKEN\"] = \"\"                    # Required to access BOT resources.\n\ndiscord = DiscordOAuth2Session(app)\n\n\n@app.route(\"/login/\")\ndef login():\n    return discord.create_session()\n\t\n\n@app.route(\"/callback/\")\ndef callback():\n    discord.callback()\n    return redirect(url_for(\".me\"))\n\n\n@app.errorhandler(Unauthorized)\ndef redirect_unauthorized(e):\n    return redirect(url_for(\"login\"))\n\n\t\n@app.route(\"/me/\")\n@requires_authorization\ndef me():\n    user = discord.fetch_user()\n    return f\"\"\"\n    \u003chtml\u003e\n        \u003chead\u003e\n            \u003ctitle\u003e{user.name}\u003c/title\u003e\n        \u003c/head\u003e\n        \u003cbody\u003e\n            \u003cimg src='{user.avatar_url}' /\u003e\n        \u003c/body\u003e\n    \u003c/html\u003e\"\"\"\n\n\nif __name__ == \"__main__\":\n    app.run()\n```\n\nFor an example to the working application, check [`test_app.py`](tests/test_app.py)\n\n\n### Requirements\n* Flask\n* requests_oauthlib\n* cachetools\n* discord.py\n\n\n### Documentation\nHead over to [documentation] for full API reference. \n\n\n[documentation]: https://flask-discord.readthedocs.io/en/latest/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweibeu%2Fflask-discord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweibeu%2Fflask-discord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweibeu%2Fflask-discord/lists"}