PHP code example of raiolanetworks / simple-oauth2-client

1. Go to this page and download the library: Download raiolanetworks/simple-oauth2-client 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/ */

    

raiolanetworks / simple-oauth2-client example snippets


return [
    ...

    'user_handler'  => App\Models\User::class,
    'group_handler' => App\Models\User::class,
];

$authController = new OAuthController;
$authController->request();



namespace App\Http\Controllers;

use Raiolanetworks\OAuth\OAuthController;

class AuthController extends Controller
{
    public function loginWithOAuth()
    {
        $authController = new OAuthController;
        return $authController->request();
    }
}

use App\Http\Controllers\AuthController;

Route::get('/login/oauth', [AuthController::class, 'loginWithOAuth'])->name('login.oauth');
bash
php artisan oauth:install
bash
php artisan vendor:publish --tag="oauth-migrations"
bash
php artisan vendor:publish --tag="oauth-config"
bash
php artisan vendor:publish --tag="oauth-translations"