40 lines
787 B
PHP
40 lines
787 B
PHP
<?php
|
|
// /auth/oauth-callback.php
|
|
|
|
$code = $_POST['code'] ?? null;
|
|
|
|
if (!$code) {
|
|
echo 'Invalid callback';
|
|
exit;
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>로그인 처리중...</title>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
fetch('/api/auth/verify-login.php', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
credentials: 'include',
|
|
body: JSON.stringify({
|
|
code: <?= json_encode($code) ?>
|
|
})
|
|
})
|
|
.then(res => res.json())
|
|
.then(result => {
|
|
if (window.opener) {
|
|
window.opener.postMessage({
|
|
type: result.status === 'success' ? 'LOGIN_SUCCESS' : 'LOGIN_FAIL',
|
|
payload: result.user || result.message
|
|
}, location.origin);
|
|
}
|
|
window.close();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|