This commit is contained in:
Manav Rathi
2024-06-11 16:04:02 +05:30
parent 8df19efc1a
commit 96386e8f9e
2 changed files with 6 additions and 22 deletions

View File

@@ -1,5 +1,4 @@
import { CustomHead } from "@/next/components/Head";
import { setClientPackageForAuthenticatedRequests } from "@/next/http";
import { setupI18n } from "@/next/i18n";
import { logUnhandledErrorsAndRejections } from "@/next/log-web";
import { appTitle, type AppName, type BaseAppContextT } from "@/next/types/app";
@@ -12,7 +11,6 @@ import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { AppNavbar } from "@ente/shared/components/Navbar/app";
import { useLocalState } from "@ente/shared/hooks/useLocalState";
import HTTPService from "@ente/shared/network/HTTPService";
import { LS_KEYS } from "@ente/shared/storage/localStorage";
import { getTheme } from "@ente/shared/themes";
import { THEME_COLOR } from "@ente/shared/themes/constants";
@@ -64,22 +62,6 @@ export default function App({ Component, pageProps }: AppProps) {
return () => logUnhandledErrorsAndRejections(false);
}, []);
const setupPackageName = () => {
const clientPackage = localStorage.getItem("clientPackage");
if (!clientPackage) return;
setClientPackageForAuthenticatedRequests(clientPackage);
HTTPService.setHeaders({
"X-Client-Package": clientPackage,
});
};
useEffect(() => {
router.events.on("routeChangeComplete", setupPackageName);
return () => {
router.events.off("routeChangeComplete", setupPackageName);
};
}, [router.events]);
const closeDialogBoxV2 = () => setDialogBoxV2View(false);
const theme = getTheme(themeColor, "photos");

View File

@@ -334,13 +334,15 @@ if (passkeySessionID) {
```
The client should redirect the user to the Ente Accounts web app with this
session ID to prompt credential authentication. We use Accounts as the central
WebAuthn hub since it allows us to handle mobile and desktop clients too.
session ID to prompt credential authentication.
```tsx
window.location.href = `${accountsAppURL()}/passkeys/verify?passkeySessionID=${passkeySessionID}&clientPackage=io.ente.photos.web&redirect=${window.location.origin}/passkeys/finish`;
```html
https://accounts.ente.io/passkeys?passkeySessionID=<sid>&clientPackage=<pkg>&redirect=<redirect>&recover=<recover-redirect>
```
We use Ente Accounts as the central WebAuthn hub since it allows us to handle
mobile and desktop clients too.
### Requesting publicKey options (begin)
#### POST /users/two-factor/passkeys/begin