Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Allow /passkeys/recover redirect

Manav Rathie51f9f1e0807
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 5921966f35..a9cfbdb510 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -15,7 +15,6 @@ import {
} from "@/next/types/app";
import { AppUpdate } from "@/next/types/ipc";
import { ensure } from "@/utils/ensure";
-import { passkeyAuthenticationFinishRedirect } from "@ente/accounts/services/passkey";
import { Overlay } from "@ente/shared/components/Container";
import DialogBox from "@ente/shared/components/DialogBox";
import {
@@ -173,11 +172,8 @@ export default function App({ Component, pageProps }: AppProps) {
// the user is logged in.
const handleOpenURL = (url: string) => {
- if (url.startsWith(passkeyAuthenticationFinishRedirect())) {
- router.push(url);
- } else {
- log.info(`Ignoring unhandled open request for URL ${url}`);
- }
+ if (url.startsWith("ente://app")) router.push(url);
+ else log.info(`Ignoring unhandled open request for URL ${url}`);
};
const showUpdateDialog = (update: AppUpdate) => {
diff --git a/web/packages/accounts/services/passkey.ts b/web/packages/accounts/services/passkey.ts
index a85f8c1c7c..6b98f75a37 100644
--- a/web/packages/accounts/services/passkey.ts
+++ b/web/packages/accounts/services/passkey.ts
@@ -12,17 +12,6 @@ import HTTPService from "@ente/shared/network/HTTPService";
import { accountsAppURL, apiOrigin } from "@ente/shared/network/api";
import { getToken } from "@ente/shared/storage/localStorage/helpers";
-/**
- * Return a URL that can be passed to the accounts app to serve as the redirect
- * back to us on successful passkey authentication.
- *
- * The returned URL begins with `window.location.origin` and will work both when
- * we're running in a web browser (of course), but also in the desktop app
- * (See: [Note: Using deeplinks to navigate in desktop app]).
- */
-export const passkeyAuthenticationFinishRedirect = () =>
- `${window.location.origin}/passkeys/finish`;
-
/**
* Redirect user to Ente accounts app to authenticate using their second factor,
* a passkey they've configured.
@@ -40,7 +29,10 @@ export const redirectUserToPasskeyVerificationFlow = (
passkeySessionID: string,
) => {
const clientPackage = clientPackageName[appName];
- const redirect = passkeyAuthenticationFinishRedirect();
+ // The returned URL begins with `window.location.origin` and will work both
+ // when we're running in a web browser, and in our desktop / mobile app.
+ // See: [Note: Using deeplinks to navigate in desktop app]
+ const redirect = `${window.location.origin}/passkeys/finish`;
const params = new URLSearchParams({
clientPackage,
passkeySessionID,