Skip to content

fix: keep Amazon login inside the plugin window - #338

Open
joswr1ght wants to merge 1 commit into
hadynz:masterfrom
joswr1ght:fix/amazon-login-external-browser
Open

joswr1ght wants to merge 1 commit into
hadynz:masterfrom
joswr1ght:fix/amazon-login-external-browser

Conversation

@joswr1ght

@joswr1ght joswr1ght commented Aug 7, 2026 •

Copy link
Copy Markdown

Problem

Amazon Cloud sync never completes on current Obsidian. The login window opens, but as soon as you enter your email and click Continue, the flow is ejected into your default system browser. Logging in there does nothing for the plugin, and the sync modal sits on "Logging in…" forever.

Cause

Obsidian's main process hardens every webContents the app creates including BrowserWindows opened by plugins with a will-navigate listener that cancels http(s) navigations and hands the URL to shell.openExternal. The login then completes in the browser's cookie jar rather than the plugin's persist:kindle-highlights partition, so did-navigate never reaches kindleReaderUrl and the promise returned by doLogin() never resolves.

Fix

Fix #337

Drop that listener from the window the plugin owns:

this.modal.webContents.removeAllListeners('will-navigate');

Obsidian registers it once, at web-contents-created, guarded by an isSecured flag, so removing it immediately after construction is sufficient and nothing re-adds it. The plugin is the only owner of this window, and it only ever loads Amazon sign-in URLs.

Verification

Tested end to end on Obsidian 1.13.4 / Electron 28.2.3 / macOS 15, with two-factor authentication enabled. The full chain now stays inside the plugin window:

Note on Passkey Incompatibility

Amazon's sign-in page throws TypeError: u.PublicKeyCredential.getClientCapabilities is not a function from AUIClients/IdentityWebAuthnAssets. Electron 28 ships Chrome 120, which predates that API. It does not block password or OTP sign-in, but an account configured for passkey-only auth likely cannot complete login in this window at all.

Thank you for this plugin, it's a great win for my Obsidian notes!

Obsidian's main process hardens every webContents the app creates,
including BrowserWindows opened by plugins, with a will-navigate
listener that cancels http(s) navigations and hands the URL to
shell.openExternal.

The initial loadURL in src/components/amazonLoginModal/index.ts
survives, since programmatic loads and HTTP redirects fire
did-start-navigation and will-redirect rather than will-navigate.
But once the Amazon sign-in page navigates on its own, the flow is
cancelled in the modal and reopened in the user's default browser.
Login then completes in a different cookie jar, did-navigate never
reaches kindleReaderUrl, and doLogin never resolves, leaving the
sync stuck on "Logging in...".

Removing that listener from the window the plugin owns restores the
flow. Verified on Obsidian 1.13.4 and Electron 28.2.3 through
/ap/signin, /ax/claim, /ap/mfa, and back to read.amazon.com/notebook
with two factor authentication enabled.
@joswr1ght

Copy link
Copy Markdown
Author

The linter error is preexisting, separate from this PR. @types/node@26.1.2 now ships ffi.d.ts using TypeScript 5.0 syntax, and this repo pins typescript@^4.9.5 The fix is one line in package.json, under devDependencies:

"@types/node": "^20.19.43",

@patricksan

Copy link
Copy Markdown

Hey Guys, do you have any idea when this will be merged? I can't sync anymore. Thanks a lot.

@jmarti44

Copy link
Copy Markdown

ETA on merge at the moment? Plugin not useable at all for new users

@mikethicke

Copy link
Copy Markdown

If you're waiting on this to be merged, I'd suggest just applying the fix yourself in the installed plugin, or pointing Claude Code or similar at this PR and asking it to apply the fix. This plugin hasn't been updated in seven months, so it seems possible the maintainer has abandoned it.

pedscn added a commit to pedscn/obsidian-kindle-plugin that referenced this pull request Oct 6, 2026
Obsidian cancels http(s) navigations in every window it creates and
reopens them in the system browser, which ejected the Amazon sign-in
flow and left sync stuck on "Logging in…". Drop that will-navigate
listener on the login window the plugin owns.

Applies upstream hadynz#338 (fixes hadynz#337), and
adds a README note explaining this fork.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@san99tiago

Copy link
Copy Markdown

Hi team +1 on fix. Could you please prioritize this, as it breaks login-flow for new users. Thanks!

@MasanobuKawachi

Copy link
Copy Markdown

Thank you for developing and maintaining this useful plugin from Japan. I'm experiencing the same Amazon login issue on Windows with Kindle Highlights v2.3.1. The Amazon notebook page opens in an external browser, but Obsidian remains stuck at "Logging in..." and no highlights are imported.
I would greatly appreciate it if PR #338 could be reviewed and merged when possible. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Amazon login

7 participants