Add support for Electron's app login event for proxies that require user:pass authentication #640

Closed
opened 2026-01-29 16:44:58 +00:00 by claunia · 1 comment
Owner

Originally created by @silent-0 on GitHub (Mar 1, 2021).

Originally assigned to: @GregorBiswanger on GitHub.

Electron's login event is emitted when the BrowserWindow requires basic username/password authentication (e.g. for a website or a proxy). Electron's default behavior is to suppress the dialog window that shows up for this authentication, so if you want to be able to use a proxy that requires auth, you have to catch this event and handle authentication programmatically.

In Electron.js, here's how I would handle this:

app.on('login', (event, webContents, request, authInfo, callback) => {
    event.preventDefault(); // Prevents the username/password dialog from showing up
    let username = "someUsername";
    let password = "somePassword";
    callback(username, password); // Calls the same authentication request that submitting the dialog form would have called
});

As far as I can tell, this functionality doesn't seem to exist in Electron.NET, which means using proxies that require authentication isn't possible.

Originally created by @silent-0 on GitHub (Mar 1, 2021). Originally assigned to: @GregorBiswanger on GitHub. Electron's [login](https://www.electronjs.org/docs/api/app#event-login) event is emitted when the BrowserWindow requires basic username/password authentication (e.g. for a website or a proxy). Electron's default behavior is to suppress the dialog window that shows up for this authentication, so if you want to be able to use a proxy that requires auth, you _have to_ catch this event and handle authentication programmatically. In Electron.js, here's how I would handle this: ```js app.on('login', (event, webContents, request, authInfo, callback) => { event.preventDefault(); // Prevents the username/password dialog from showing up let username = "someUsername"; let password = "somePassword"; callback(username, password); // Calls the same authentication request that submitting the dialog form would have called }); ``` As far as I can tell, this functionality doesn't seem to exist in Electron.NET, which means using proxies that require authentication isn't possible.
claunia added the Feature label 2026-01-29 16:44:58 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#640