Skip to content

Commit 48b28b8

Browse files
committed
🐛 Fix oauth redirect uri and popup redirect issue
1 parent 465b4c2 commit 48b28b8

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

console/src/routes/project/[projectId]/auth/methods/[providerId]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
}
3333
3434
const redirectUri =
35-
`https://${project.slug}.${environment.PUBLIC_AI_AGENT_DOMAIN}/auth/handler/${$page.data.authMethod.providerId}`.toLowerCase();
35+
`https://${project.slug}.${environment.PUBLIC_AI_AGENT_DOMAIN}/oauth/handler/${$page.data.authMethod.providerId}`.toLowerCase();
3636
3737
const { form, errors, validate } = superForm($page.data.form, {
3838
validators: zod.object({

frontend/src/lib/usecases/members/initSignInWithRedirect.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ export const initSignInWithPopup = async (authMethod: PublicAuthMethodDto, proje
8181
try {
8282
await loginWithOAuthCode({
8383
providerId: authMethod.provider.toLowerCase(),
84-
redirectUri:
85-
data.redirectUri ?? `${window.location.origin}${window.location.pathname}`,
84+
redirectUri: data.redirectUri,
8685
state: data.state,
8786
code: data.code,
8887
projectId

frontend/src/routes/oauth/handler/[providerId]/+page.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import { getRedirectResult } from "$lib/utils/oauthUtils";
66
import { homeRoute } from "$lib/routes/routes";
77
import { mainContextStore } from "$lib/stores/main-context";
8+
import { page } from "$app/stores";
89
910
onMount(async () => {
1011
const projectId = $mainContextStore.publicProjectConfig?.id;
@@ -17,9 +18,12 @@
1718
try {
1819
const { code, state } = await getRedirectResult();
1920
21+
let redirectUri =
22+
`${window.location.protocol}//${window.location.host}/oauth/handler/${$page.params.providerId}`.toLowerCase();
23+
2024
window.opener.postMessage(
2125
{
22-
redirectUri: null,
26+
redirectUri,
2327
code,
2428
state,
2529
messageType: "OAuthRedirectResult"

0 commit comments

Comments
 (0)