commit
This commit is contained in:
39
kngil/auth/oauth-callback.php
Normal file
39
kngil/auth/oauth-callback.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user