Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): selfhost redirect url (#6426)

EYHN80c7750f4a47
diff --git a/packages/frontend/core/src/utils/cloud-utils.tsx b/packages/frontend/core/src/utils/cloud-utils.tsx
index 32ffdbc081..2efae58470 100644
--- a/packages/frontend/core/src/utils/cloud-utils.tsx
+++ b/packages/frontend/core/src/utils/cloud-utils.tsx
@@ -94,13 +94,13 @@ async function signIn(
url.searchParams.set(key, searchParams[key]);
}
- const redirectUri =
- runtimeConfig.serverUrlPrefix +
- (environment.isDesktop
- ? buildRedirectUri('/open-app/signin-redirect')
- : location.pathname);
+ const redirectUri = new URL(location.href);
- url.searchParams.set('redirect_uri', redirectUri);
+ if (environment.isDesktop) {
+ redirectUri.pathname = buildRedirectUri('/open-app/signin-redirect');
+ }
+
+ url.searchParams.set('redirect_uri', redirectUri.toString());
return fetch(url.toString(), {
method: 'POST',