UPDATE: Outh2 google

This commit is contained in:
2026-03-30 16:13:00 +07:00
parent d3f128b284
commit 0410ae508e
21 changed files with 714 additions and 68 deletions

33
outh2Test.html Normal file
View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Test Google OAuth</title>
</head>
<body>
<h2>Google OAuth Test</h2>
<button onclick="login()">Login with Google</button>
<button onclick="getProfile()">Call API (check login)</button>
<pre id="output"></pre>
<script>
const API = "http://localhost:3344";
function login() {
window.location.href = API + "/auth/google/login";
}
async function getProfile() {
const res = await fetch(API + "/users/current", {
method: "GET",
credentials: "include"
});
const data = await res.json();
document.getElementById("output").innerText = JSON.stringify(data, null, 2);
}
</script>
</body>
</html>