diff options
| author | MaheshtheDev <[email protected]> | 2025-10-17 04:29:32 +0000 |
|---|---|---|
| committer | MaheshtheDev <[email protected]> | 2025-10-17 04:29:32 +0000 |
| commit | 90eea41dedfd2fa228fcb7e6a08c01d6ae7a449e (patch) | |
| tree | 298034f9e98ac5f94a400b7829d6653cd8ce2bac | |
| parent | Merge pull request #488 from naman06dev/main (diff) | |
| download | supermemory-90eea41dedfd2fa228fcb7e6a08c01d6ae7a449e.tar.xz supermemory-90eea41dedfd2fa228fcb7e6a08c01d6ae7a449e.zip | |
fix: magic link auth for chrome extension (#492)
The issue is whenever a user is trying to log in with an email and a one-time code, the Chrome extension is not able to authenticate. The fix is to add a callback URL with a query parameter of `extension-auth-success` equal to `true`, which will allow the Chrome extension to identify and verify the auth whenever a user is trying to log in into the Chrome extension.
| -rw-r--r-- | packages/ui/pages/login.tsx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/ui/pages/login.tsx b/packages/ui/pages/login.tsx index 2179f177..4d823d76 100644 --- a/packages/ui/pages/login.tsx +++ b/packages/ui/pages/login.tsx @@ -47,17 +47,20 @@ export function LoginPage({ // Create callback URL that includes redirect parameter if provided const getCallbackURL = () => { const origin = window.location.origin; + let finalUrl: URL; + if (redirectUrl) { - // Validate that the redirect URL is safe (same origin or allow external based on your security requirements) try { - const url = new URL(redirectUrl, origin); - return url.toString(); + finalUrl = new URL(redirectUrl, origin); } catch { - // If redirect URL is invalid, fall back to origin - return origin; + finalUrl = new URL(origin); } + } else { + finalUrl = new URL(origin); } - return origin; + + finalUrl.searchParams.set("extension-auth-success", "true"); + return finalUrl.toString(); }; // Load last used method from localStorage on mount |