Discord is one of the top gaming social networking site available now. For some sites, it is required to integrate Discord Signin . So am explaining in this post how to do the same.
1) Create an App in Discord Developers Area
Visit: https://discord.com/developers/ by login and create an app.
Click on link New Application.
2. Credentials Update
In this screen, they will ask you for name of app, description,logo.etc.. Also you have to give the endpoint website URL, terms link,services link.etc... Also you will get the Application ID and secret from this screen. Copy it and keep it as we are using it in our script.
3)Creating OAuth Id's
Here they will ask you to provide the redirect URL after login with discord. Also you have to select the scopes which u needed after login in. The discord API will pass you all the required parameters based on the scope.
5)Configure BOT
Here add bot and you will get a token.Save it for our App.
6) Download Integrating Script from Github.
You have to download the following github code in my repo. https://github.com/litto/Discord-Signin
Now based on this script I am explaining what to configure and how to achieve it..
5)Updating Credentials in the Script.
In the root folder, you can find the config file which you need to edit and update your credentials.Its code will be like this:-
<?php
# CLIENT ID
# https://i.imgur.com/GHI2ts5.png (screenshot)
$client_id = "#CLIENTID";
# CLIENT SECRET
# https://i.imgur.com/r5dYANR.png (screenshot)
$secret_id = "#SECRETID";
# SCOPES SEPARATED BY SPACE
# example: identify email guilds connections
$scopes = "email";
# REDIRECT URL
# example: https://mydomain.com/includes/login.php
# example: https://mydomain.com/test/includes/login.php
$redirect_url = "http://sitename.com/login.php";
# IMPORTANT READ THIS:
# - Set the `$bot_token` to your bot token if you want to use guilds.join scope to add a member to your server
# - Check login.php for more detailed info on this.
# - Leave it as it is if you do not want to use 'guilds.join' scope.
# https://i.imgur.com/2tlOI4t.png (screenshot)
$bot_token = "#BOTTOKEN";
Update all the keys, scopes which we already configured in the Discord developer screen.
6) Now place includes folder in the root of your application. Set redirect URL to the login script in the includes folder.
7) Now run the index file, after signing you can see the details fetched from discord app.These details you can use according to your convinience.