Proxy authentication from render process


#1

I am trying to authenticate my proxy.
If I set below code( login event ) in main process it is working fine, however if I try to set authentication from render process it is not authenticating.

Main.js

var proxy_password ="password";
var proxy_username = "username";
app.on('login', (event, webContents, request, authInfo, callback) => {
    event.preventDefault()
callback(proxy_username, proxy_password)
})

How to use above code from render process.

Thanks
Jk


#2

event.preventDefault() doesn’t work across process boundaries, if you want to use it in an event listener in the main process then the listener must be implemented in the main process.


#3

Hi,

Thanks for your suggestion.
I tried the below and it worked.

main.js

app.on('login', (event, webContents, request, authInfo, callback) => {
    event.preventDefault();
})

render.js

    var proxy_password ="password";
    var proxy_username = "username";
    app.on('login', (event, webContents, request, authInfo, callback) => {
        callback(proxy_username, proxy_password)
    })

-Jk