Setting up linked roles

Roles Discord only grants once an account is connected – including the URLs that must be entered in the Developer Portal.

How it works#

Linked roles are a Discord feature: a role can be configured so it is only granted when certain requirements are met. Those requirements do not live in Discord itself – they come from an application, here from the dashboard.

The flow: a member clicks Connect account in Discord, is sent to the dashboard, signs in with Discord – and the dashboard writes the values (e.g. playtime, level) into the account's role connection. Discord then evaluates the requirements and grants the role.

URLs in the Developer Portal#

For every bot application that should use linked roles, two URLs must be entered in the Developer Portal exactly like this. The dashboard shows them in the linked-roles management; the patterns are:

  • Redirect URL (OAuth2) – https://dash.modiq.fr/api/linked-roles/<bot-id>/callback – enter under *OAuth2 → Redirects*. Discord rejects the connection flow if the URL does not match character for character.
  • Verification URL – https://dash.modiq.fr/linked-roles/<bot-id> – set automatically as the application's role_connections_verification_url during registration; you do not enter it by hand.

Regular login callback URL

Besides the linked-roles redirect URL, the application still needs its regular login callback URL under *OAuth2 → Redirects*.

Set up#

  1. Create metadata fields

    Define the fields that should serve as requirements – e.g. a numeric field for playtime. Each field has a key, a type (number, boolean, date, text) and a description visible in Discord.

  2. Register

    Register stores the fields at Discord and sets the verification URL. If it fails, Discord reports the reason – usually a missing redirect URL or an invalid token.

  3. In Discord: role → links → requirement

    In the server settings under Roles, open the role, switch to the Links tab and add the field with the desired value as a requirement.

  4. Have members connect

    Members click Connect account in Discord and land on the dashboard's connection page.

When it does not work#

  • “This app is not fully set up yet” – the metadata has not been registered.
  • “The connection expired or was tampered with” – the flow finished too late or started in another browser; simply start over.
  • “The server could not be determined” – the connection was not started from within Discord.
  • Role never arrives – the requirement is not met, or the bot role sits below the role being granted.
Last updated