<?php
require __DIR__ . '/_boot.php';

use App\Services\OAuthLoginService;

$provider = (string)($_GET['provider'] ?? $_GET['p'] ?? '');
$service = new OAuthLoginService();

if (!empty($_GET['code']) || !empty($_GET['error'])) {
    $service->callback($provider, $_GET);
}

$service->start($provider);
