PHP code example of martinbean / socialite-discord-provider
1. Go to this page and download the library: Download martinbean/socialite-discord-provider library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
martinbean / socialite-discord-provider example snippets
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Laravel\Socialite\Facades\Socialite;
class DiscordController extends Controller
{
/**
* Redirect the user to the Discord authentication page.
*
* @return \Illuminate\Http\Response
*/
public function redirectToProvider()
{
return Socialite::driver('discord')->redirect();
}
/**
* Obtain the user information from Discord.
*
* @return \Illuminate\Http\Response
*/
public function handleProviderCallback()
{
$user = Socialite::driver('discord')->user();
// $user->token;
}
}
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Laravel\Socialite\Facades\Socialite;
class DiscordController extends Controller
{
/**
* Redirect the user to the Discord authentication page.
*
* @return \Illuminate\Http\Response
*/
public function redirectToProvider()
{
return Socialite::driver('discord')->bot()->redirect();
}
}