Skip to content

Commit

Permalink
Merge pull request #12 from arthurpar06/addOauthDocs
Browse files Browse the repository at this point in the history
Add docs for OAuth
  • Loading branch information
nabeelio authored Mar 5, 2024
2 parents cbb9995 + dac6135 commit 6d6ad08
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 1 deletion.
34 changes: 34 additions & 0 deletions docs/oauth/discord.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
id: discord
title: Discord
sidebar_title: Discord
---

First, you need to [create a developer application](https://discord.com/developers/applications) on the Discord website. If you have already created this application to use the rich presence of vmsACARS, you can use the same one.

Next, go to OAuth2 > General. Copy the client ID and client secret to be used in the configuration later. Additionally, you need to add a redirect; the URL to add is `https://yourdomain.com/oauth/discord/callback`.

![](img/create-discord.png)

In the `.env` file, add the following:

```shell title=".env"
DISCORD_OAUTH_ENABLED=true
DISCORD_CLIENT_ID={your_client_id_copied_before}
DISCORD_CLIENT_SECRET={your_client_secret_copied_before}
```

Now, your users can link their Discord account to their phpVMS account and use their Discord account to log in. The link between the two accounts is automatically established when clicking the "Login with Discord" button on the login page. However, if the email address of the Discord account is different from the email address of the phpVMS account, it must be done manually on the profile page.

## Sending Private Messages

If you want to send private message notifications to your users (development still in progress), you need to create a Discord bot in the bot section of your Discord application and copy the token. <br/>
If this option is not enabled, the `discord_private_channel_id` field will not be filled. This field contains a unique discussion ID between the bot and the user, so it is imperative to have a bot to fill it.

![](img/create-discord-bot.png)

Place the token in the `.env`:

```shell title=".env"
DISCORD_BOT_TOKEN={your_bot_token_copied_before}
```
Binary file added docs/oauth/img/create-discord-bot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/oauth/img/create-discord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/oauth/img/create-vatsim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions docs/oauth/vatsim.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
id: vatsim
title: VATSIM
sidebar_title: VATSIM
---

First, you need to [create a vatsim organization](https://auth.vatsim.net/organization/requirements) on the VATSIM website.

After your organization has been approved by VATSIM, you can create a new OAuth client.
Go to the [Organizations](https://auth-dev.vatsim.net/organization) tab and into the organization you created. Navigate to the 'OAuth clients' tab and add a new client.
In the redirect URL, enter: `https://yourdomain.com/oauth/vatsim/callback`

![](img/create-vatsim.png)

In the `.env` file, add the following:

```shell title=".env"
VATSIM_OAUTH_ENABLED=true
VATSIM_CLIENT_ID={your_client_id}
VATSIM_CLIENT_SECRET={your_client_secret}
```
You can retrieve your client ID and your client secret from the OAuth clients page after creating the client as explained above.

Now, your users can link their VATSIM account to their phpVMS account and use their VATSIM account to log in. The link between the two accounts is automatically established when clicking the "Login with VATSIM" button on the login page. However, if the email address of the VATSIM account is different from the email address of the phpVMS account, it must be done manually on the profile page.
10 changes: 9 additions & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,17 @@ module.exports = {
'config/email',
'config/optimizing',
'config/notifications',
'config/backups',
'config/backups'
]
},
{
type: 'category',
label: 'OAuth',
items: [
'oauth/discord',
'oauth/vatsim',
]
},
{
type: 'category',
label: 'Themes and Layouts',
Expand Down

0 comments on commit 6d6ad08

Please sign in to comment.