<?php
ob_start();
require_once dirname(__DIR__) . '/config.php';
require_once dirname(__DIR__) . '/includes/qq_config.php';

$config = getQQConfig();

session_start();
$state = bin2hex(random_bytes(16));
$_SESSION['qq_state'] = $state;

header('Location: https://graph.qq.com/oauth2.0/authorize?' . http_build_query([
    'response_type' => 'code',
    'client_id'     => $config['app_id'],
    'redirect_uri'  => $config['redirect_uri'],
    'state'         => $state,
    'scope'         => 'get_user_info'
]));
exit;