FUJI/src/pages/callback.astro
2024-08-24 17:12:25 +08:00

23 lines
542 B
Text

<div></div>
<script>
import { makeLogtoClient } from "../utils/auth"
import LogtoClient from "@logto/browser"
const callbackHandler = async (logtoClient: LogtoClient) => {
try {
await logtoClient.handleSignInCallback(window.location.href)
if (!logtoClient.isAuthenticated) {
window.location.assign("/")
return
}
// Handle successful sign-in
window.location.assign("/")
}
catch (error) {
window.location.assign("/")
}
}
const logtoClient = makeLogtoClient()
callbackHandler(logtoClient)
</script>