UPDATE: Outh2 google
All checks were successful
Build and Release / release (push) Successful in 1m16s
All checks were successful
Build and Release / release (push) Successful in 1m16s
This commit is contained in:
@@ -1,33 +0,0 @@
|
|||||||
<!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>
|
|
||||||
Reference in New Issue
Block a user