socialite laravel 7
composer require laravel/socialite
socialite laravel 7
composer require laravel/socialite
socialite laravel 7
return Socialite::driver('github')
->setScopes(['read:user', 'public_repo'])
->redirect();
socialite laravel 7
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Laravel\Socialite\Facades\Socialite;
class LoginController extends Controller
{
/**
* Redirect the user to the GitHub authentication page.
*
* @return \Illuminate\Http\Response
*/
public function redirectToProvider()
{
return Socialite::driver('github')->redirect();
}
/**
* Obtain the user information from GitHub.
*
* @return \Illuminate\Http\Response
*/
public function handleProviderCallback()
{
$user = Socialite::driver('github')->user();
// $user->token;
}
}
socialite laravel 7
'github' => [
'client_id' => env('GITHUB_CLIENT_ID'),
'client_secret' => env('GITHUB_CLIENT_SECRET'),
'redirect' => 'http://your-callback-url',
],
socialite laravel 7
return Socialite::driver('google')->stateless()->user();
socialite laravel 7
return Socialite::driver('google')
->with(['hd' => 'example.com'])
->redirect();
socialite laravel 7
$user = Socialite::driver('github')->userFromToken($token);
socialite laravel 7
return Socialite::driver('github')
->scopes(['read:user', 'public_repo'])
->redirect();
socialite laravel 7
$user = Socialite::driver('twitter')->userFromTokenAndSecret($token, $secret);
socialite laravel 7
Route::get('login/github', 'Auth\LoginController@redirectToProvider');
Route::get('login/github/callback', 'Auth\LoginController@handleProviderCallback');
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us