FUJI/src/pages/callback.astro
2025-04-24 22:10:04 +08:00

30 lines
611 B
Text

<div></div>
<script>
import { makeLogtoClient } from "../utils/auth"
const callbackHandler = async (logtoClient) => {
console.log("callbackHandler")
try {
await logtoClient.handleSignInCallback(window.location.href)
if (!logtoClient.isAuthenticated) {
console.log("User not authenticated")
window.location.assign("/")
return
}
}
catch (error) {
console.log(error)
window.location.assign("/")
}
}
console.log("Callback page loaded")
try {
const logtoClient = makeLogtoClient()
callbackHandler(logtoClient)
}
catch (error) {
console.log(error)
}
</script>