Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
docs(auth): oauth2discord
Browse files Browse the repository at this point in the history
  • Loading branch information
zhudotexe committed Sep 1, 2021
1 parent e69c6b4 commit 0b86cb8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ deployment_tools/gae/apps
deployment_tools/gae/requirements.txt
py4web/assets
workspace.code-workspace
venv
venv
docs/_build
19 changes: 19 additions & 0 deletions docs/chapter-13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,25 @@ OAuth2 with Facebook (tested OK)
The client id and client secret must be provided by Facebook.

OAuth2 with Discord
~~~~~~~~~~~~~~~~~~~

.. code:: python
from py4web.utils.auth_plugins.oauth2discord import OAuth2Discord
auth.register_plugin(OAuth2Discord(
client_id=DISCORD_CLIENT_ID,
client_secret=DISCORD_CLIENT_SECRET,
callback_url="auth/plugin/oauth2discord/callback"))
To obtain a Discord client ID and secret, create an application at https://discord.com/developers/applications.
You will also have to register your OAuth2 redirect URI in your created application, in the form of
``http(s)://<your host>/<your app name>/auth/plugin/oauth2discord/callback``

.. note::
As Discord users have no concept of first/last name, the user in the auth table will contain the
Discord username as the first name and discriminator as the last name.

Tags and Permissions
--------------------

Expand Down

0 comments on commit 0b86cb8

Please sign in to comment.