mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 11:39:16 +01:00
fix: 🐛 Fix broken auth consent flow
Some checks failed
Some checks failed
This commit is contained in:
parent
7ae35b2cf0
commit
d01aa22477
3 changed files with 11 additions and 13 deletions
43
app/pages/callback/[domain].vue
Normal file
43
app/pages/callback/[domain].vue
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<template>
|
||||
<Card v-if="code && domain" class="w-full max-w-md *:w-full">
|
||||
<CardHeader>
|
||||
<CardTitle>Signing in...</CardTitle>
|
||||
<CardDescription>You will be redirected shortly.</CardDescription>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
<Card v-else class="w-full max-w-md *:w-full">
|
||||
<CardHeader>
|
||||
<CardTitle>Error</CardTitle>
|
||||
<CardDescription>
|
||||
Missing code or domain in the callback URL.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
Card,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "~/components/ui/card";
|
||||
|
||||
// This page handles the OAuth callback and signs the user in
|
||||
definePageMeta({
|
||||
layout: "auth",
|
||||
});
|
||||
|
||||
const code = useRequestURL().searchParams.get("code");
|
||||
const domain = useRoute().params.domain as string;
|
||||
const authStore = useAuthStore();
|
||||
|
||||
if (code && domain) {
|
||||
const newOrigin = new URL(`https://${domain}`);
|
||||
|
||||
await authStore.finishSignIn(code, newOrigin);
|
||||
await navigateTo("/", {
|
||||
external: true,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue