<?php
$clientId = "ee57d432-3996-4b15-ae09-1359eeee2fd9";
$tenantId = "dad84a33-d094-4236-86db-b67e2093e5fb";
$redirectUri = "https://re.hrdandrecruitments.com/provincia/callback.php";
$scope = "https://outlook.office365.com/.default offline_access"; // Required scopes

$authUrl = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/authorize?" . http_build_query([
    "client_id" => $clientId,
    "response_type" => "code",
    "redirect_uri" => $redirectUri,
    "scope" => $scope,
    "response_mode" => "query"
]);

// Redirect user to Microsoft login
header("Location: $authUrl");
exit();
?>
