> For the complete documentation index, see [llms.txt](https://docs.pmpf.johnodon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pmpf.johnodon.com/functions/discordoauth.md).

# discordOauth()

Makes "Login with Discord" simpler

#### Usage: discordOauth(client\_id, client\_secret, permissions)

To start, create a Discord application [here](https://discord.com/developers/applications/).

{% tabs %}
{% tab title="Client ID" %}
![](https://16310500-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7ZTZc2Gs3NbhXTM7xR%2F-M7_-hJQtBRzaMXhM65_%2F-M7_-p0vn5Z2HY-WpsRN%2Fimage.png?alt=media\&token=bc106aaf-4086-45b0-b931-cb988ac311bc)

The Client ID can be found under General Information, by the application name.
{% endtab %}

{% tab title="Client Secret" %}
![](https://16310500-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7ZTZc2Gs3NbhXTM7xR%2F-M7ZuxFX3VSZwMPOQ8Bx%2F-M7ZvcWw0fo4RUwLj20H%2Fimage.png?alt=media\&token=aab75442-2bd4-4204-aaf7-578248787ec1)

The Client Secret can be found under General Information, by the application name. Do not share this code.
{% endtab %}

{% tab title="Permissions" %}
The permissions are the permissions that the server needs. Separate these by a space. \
Example: "identify email connections guilds relationships.read"
{% endtab %}
{% endtabs %}

I would recommend putting `discordOauth()` on a separate page than the login page. To activate the login, add `?action=login` to the end of the URL. If discord and the user accept the request, it will redirect back to the page and the function will return results about the user. (Use `print_r` to print them). If the user denies the request or discord does not accept it, you will be sent back to the page and the function will return with "User denied the request.".
