Implement a discord authentication


You can check a demo here


  • Security concern: I highly suggest to restrict login via discord to your discord guild members (see the guild setting in the discord-auth setting admin panel). Discord allow you to restrict access to your discord guild to people that match some critera (discord call that the verification level). This discord feature will help you to restrict who can register to your Azuriom website and avoid malicious users that could try to register to your website with a fake discord account, an unverified email adress that you shouldn't trust, etc....
  • This is the very first release, except bugs. I will do my best to fix them
  • I don't recommand to use this plugin with basic registration enabled. I suggest to use either register and login with discord OR basic authentification to avoid confusing your users



Via admin panel

Just go to your admin panel, download and active this plugin.

OR manually

Go to plugin folder, git clone https://github.com/Over2Craft-mc/discord-auth.git then run cd discord-auth && composer update

Register a discord app and fill credentials

Register a Discord application here https://discord.com/developers/applications and get client ID and client secret in OAuth2 panel. Fill the "redirects" fields with http://domain.test/discord-auth/callback Go to plugin's settings and fill client_id and client_secret

Add a "login via discord" button in your templates

You might need to add button where user can click to login using discord-auth. Basiclly a login button. Example with ressources/themes/carbon/view/elements/navbar.blade.php (usually you can find default login button by searching for route('login') string)

        <li class="nav-item">
            <a class="btn btn-secondary mx-1 my-2" href="{{ route('discord-auth.login') }}">{{ trans('discord-auth::messages.login_via_discord') }}</a>

A more advanced way

You can also use some blade directives hasDiscordLinked and hasNotDiscordLinked introduced in version 1.2.0. Here are a few examples

Examples (those things {{-- blablabla --}} are just comments to help you, you can remove them)

     @plugin('discord-auth') {{-- if plugin discord-auth is enabled --}}
           @guest  {{-- if user is not authenticated --}}
                 <a href="{{ route('discord-auth.login') }}">Connect with discord</a>
     @plugin('discord-auth') {{-- if plugin discord-auth is enabled --}}
           @auth  {{-- if user is authenticated --}}
                @hasNotDiscordLinked {{-- if user hasn't a discord account linked --}}
                     <a href="{{ route('discord-auth.login') }}">Link your account with Discord</a>

An easier but less aesthetic way

You can also use the admin panel to add a navigation button, but it may be a bit less aesthetic Admin panel -> Navigation

Test if it works

Try to access http://yourdomain.com/discord-auth and see if it works


Des infos sur la compatibilité avec la nouvelle version de Azuriom (1.0.2)?

May 9, 2022 at 9:36 AM

It would be great if I could disable registration via Discord. For example, use the plugin to log in only with already linked accounts, because if the option to change nickname (minecraft) is usually disabled for users, then the nickname-Discord ID does not look very nice.

December 4, 2021 at 6:51 AM

Ca serai un plus d'avoir le tag de discord sur la page profil pour tous, un moyen de délink un joueur par la page admin au cas ou :D

October 29, 2021 at 12:50 AM

edit: Tout fonctionne maintenant ! Ça a été très bien expliqué et documenté :) Merci à toi !

August 31, 2021 at 10:56 AM

_voltis, Pour le premier point c'est fait. Pour le deuxième point c'est fait aussi, mais ce sera à toi d'ajouter les boutons manuellement https://github.com/magrigry/discord-auth/releases/tag/1.2.0

August 30, 2021 at 12:09 PM

Il faudrait préciser qu'il faut rajouter en redirect_uri: https://domaine.com/discord-auth/callback Les comptes sont créés avec l'ID comme nom, et non le pseudo Il ne manque plus qu'un bouton pour associer son discord à un compte déjà existant ^^ !

August 29, 2021 at 10:49 AM



  • Author: magrigri
  • Type: Plugin
  • Version: 1.3.1
  • Downloads: 1193
  • Released: August 28, 2021 at 10:54 PM
  • Updated: January 13, 2022 at 8:50 AM
Support GitHub
From the same author