Files
superlink/api/auth/csrf.php
T

11 lines
373 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 获取 CSRF Token GET /api/auth/csrf.php
* 供登录页等未登录场景在发起 POST 前先取会话绑定的 Token。
* 登录后 session.php 会随用户信息一并返回 csrf_token(common.js 自动缓存)。
*/
require_once __DIR__ . '/../common/Api.php';
$pdo = Api::boot(['public' => true]);
Response::success(['csrf_token' => csrfToken()]);