Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dubyadude/oauthgate
Protect a NGINX Site with Discord OAuth
https://github.com/dubyadude/oauthgate
discord discord-oauth discord-oauth2 nginx nginx-configuration
Last synced: 3 months ago
JSON representation
Protect a NGINX Site with Discord OAuth
- Host: GitHub
- URL: https://github.com/dubyadude/oauthgate
- Owner: DubyaDude
- License: mit
- Created: 2023-03-20T23:43:25.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-05T02:35:40.000Z (11 months ago)
- Last Synced: 2024-10-11T01:18:56.306Z (4 months ago)
- Topics: discord, discord-oauth, discord-oauth2, nginx, nginx-configuration
- Language: C#
- Homepage:
- Size: 36.1 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# OAuthGate - A NGINX Discord OAuth Reverse Proxy
This project allows securing an NGINX reverse proxied site via Discord OAuth.
## Setting up OAuthGate Process
### appsettings.json
Configure the `appsettings.json` like so:
```json
"DiscordOptions": {
"AuthCookieName": "APP_NAME_HERE-auth",
"Client": {
"Id": 0,
"Secret": "0"
},
"WhitelistedUsers": [ 0, 1 ],
"WhitelistedGuilds": [ 0, 1 ],
"WhitelistedRoles": {
"0": [ 1, 2 ],
"3": [ 4, 5 ]
},
"EmailHandling": "None"
}
```
- AuthCookieName: The name of the Authentication Cookie.- Client.Id: The Client ID of the Discord Application.
- Client.Secret: The Secret of the Discord Application.
- WhitelistedUsers: Whitelisted Discord Discord User IDs.
- WhitelistedGuilds: Whitelisted Discord Guild IDs. (They need to be part of the guild)
- WhitelistedRoles: Whitelisted Discord Guild Role Ids. (They need to be part of the guild and have the role)
- EmailHandling: How to handle email
- None: Do not ask for an email when calling Discord OAuth.
- Log: Ask for email when calling Discord OAuth.
- LogAndRequire: Ask for email when calling Discord OAuth and check that an email was given from the callback.**Whitelist Behaviour** - A user must be part of either Whitelisted Guilds, Whitelisted Roles, or Whitelisted Users if either one has a value. If all are null/empty, any Discord Login will be allowed.
### Running on Different Port
To run the process on a specific port, start the OAuthGate project like so:
```
./OAuthGate --urls=https://localhost:7161
```## Setting up NGINX Config
Use the [nginx.conf](https://github.com/DubyaDude/nginx-discord-oauth-reverse-proxy/blob/master/nginx.conf) file in the root of the repo and replace any instance of `https://localhost:7161` if you end up using a different port.