PHP code example of impressolabs / laravel-sign-in-with-huawei
1. Go to this page and download the library: Download impressolabs/laravel-sign-in-with-huawei 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/ */
impressolabs / laravel-sign-in-with-huawei example snippets
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Laravel\Socialite\Facades\Socialite;
class HuaweiSigninController extends Controller
{
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function login()
{
return Socialite::driver("huawei")
->redirect();
}
public function callback(Request $request)
{
// get abstract user object, not persisted
$user = Socialite::driver("huawei")
->user();
}
}