Skip to content

NotActuallyTerry/discord-authentik-rolesync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Roles to Authentik Groups sync

This is a python application that will sync Discord Roles to Authentik Groups.

For this to work you need to:

  1. Implement the Discord Authentik Identity Provider
  2. Create a User Property Mapping that stores their Discord ID as an attribute, under attributes.discord.id
  3. Add a discord_role_id attribute to each Authentik group you'd like to sync, e.g. discord_role_id: "940183386595655771" NOTE: Make sure to enclose the ID in quotes, otherwise Authentik will round the number & break the link!
  4. Create an Authentik service account, create a role & assign it the following permissions:
    • Add user to group
    • Remove user from group
    • Can view Group
    • Can view User
    • Can view User OAuth Source Connection
  5. Create an API key (under Tokens and App passwords), assigning it to the above service account
  6. Create a Discord Application (here) & add the bot to your server.
    • Make sure it has the Server Members intent, otherwise it won't receive role membership updates

Example config

      DISCORD_BOT_TOKEN: MZ1yGvKTjE0rY0cV8i47CjAa.uRHQPq.Xb1Mk2nEhe-4iUcrGOuegj57zMC
      DISCORD_GUILD_ID: 444746940761243652
      AUTHENTIK_HOST: https://authentik-instance/api/v3
      AUTHENTIK_API_KEY: I2khOuRBfgZzohV8fQAbJcRXYIJIuXKWe1Q88OTqD8lkOcEoqcwz7z9XIoGJ

About

Hastily-ported version of my Discord to Keycloak role sync bot, now for Authentik!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors