OAuth2 Setup
OAuth2 can be useful for larger servers that use the self-service bot. It eliminates the need to use secret keys. If you and your community are perfectly fine with secret keys, you do not need to configure it!
Configuring your Discord integration/bot
In order to enable oAuth2 for your server, the discord integration you created to get the bot running needs to be updated. If you don't have a bot already, please check https://discord.com/channels/1408474043148927107/1412922009695944754
- Go to discord developer portal applications: https://discord.com/developers/applications/
- Select your bot
- Go to oAuth2, press "Add Redirect". Change the redirect to
https://<your-domain>/oauth/discordCallback
- Copy the
Client ID
and note it somewhere safe - Reset the
Client Secret
and note it somewhere safe.
Configuring your Sinus instance
Now swap to configure your Sinus instance.
You can either use the .env
file if you use the sample compose file (recommended) , or otherwise set the proprties in your config.json
for the auth-service
SINUS_DISCORD_OAUTH_CLIENT_ID
orSinusSynchronous.DiscordOAuthClientId
: Put yourClient ID
hereSINUS_DISCORD_OAUTH_CLIENT_SECRET
orSinusSynchronous.DiscordOAuthClientSecret
: Put yourClient Secret
hereSINUS_PUBLIC_OAUTH_BASE_URI
orSinusSynchronous.PublicOAuthBaseUri
: Set it tohttps://<your-domain>/oauth
On JSON and Environment config
The sample composefile comes with a few conveniently predefined environment variables. It's encouraged to use these, instead of changing anything manually. If you do run a different setup, you always have the following options to configure a property instead:
- Use the
.json
config file by putting the desired config key in directly, for exampleSinusSynchronous.DiscordOAuthClientId
- Use environment variables, passed to the container, by replacing all
.
with__
, for example ``SinusSynchronous__DiscordOAuthClientId`
Further Reading
https://discord.com/developers/docs/topics/oauth2 https://www.rfc-editor.org/rfc/rfc6749 https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-9.0