PHP code example of ivao-colombia / api-login

1. Go to this page and download the library: Download ivao-colombia/api-login 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/ */

    

ivao-colombia / api-login example snippets


"ivao" => [
    "redirect" => "/your-callback"
]

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Laravel\Socialite\Facades\Socialite;

class IvaoLoginController
{
    public function redirect()
    {
        return Socialite::driver('ivao')->redirect();
    }

    public function callback()
    {
        $ivaoUser = Socialite::driver('ivao')->user()->getRaw();

        Auth::login(new User($ivaoUser));

        return redirect()->to('home');
    }
}

[
  "vid" => 385415,
  "firstName" => "Joao Pedro",
  "lastName" => "Henrique",
  "administrativeRating" => 2,
  "atcRating" => 5,
  "pilotRating" => 5,
  "division" => "BR",
  "country" => "BR",
  "staff" => [ "BR-AWM", "WD9" ]
]