<?php

// header("Access-Control-Allow-Origin: https://test.thomasbouckson.fr");
// header("Access-Control-Allow-Headers: Content-Type, Authorization");
// header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
// header("Access-Control-Allow-Credentials: true");
// header("Access-Control-Allow-Origin: *");


$clientID = 'Ov23liPjdVld6EyBfNUw';
$redirectUri = 'https://' . $_SERVER['HTTP_HOST'] . '/auth-callback.php';

$params = [
    'client_id' => $clientID,
    'redirect_uri' => $redirectUri,
    'scope' => 'repo,user', // ← repo = obligatoire pour repo privé, user = optionnel
    'state' => bin2hex(random_bytes(16)), // sécurité CSRF
];

header('Location: https://github.com/login/oauth/authorize?' . http_build_query($params));
exit;



