Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use the Login Event in Electron Framework?

I would like some help understanding how the Event: 'login' feature in Electron Framework works. Is it the low level implementation of the Password Autofill/Remember Password feature common in browsers? I would like to use this to autofill a password in a webpage's login flow e.g.

const electron = require('electron')
const {app,BrowserWindow} = electron

app.on('ready', ()=>{
    let win = new BrowserWindow({
        width:800,
        height:600
    })
//This is where I'm confused
app.on('login', (event, webContents, request, authInfo, callback) => {
  event.preventDefault();
  callback('my_username', 'my_password');
});
//How to implement autofill to https://accounts.google.com?



    win.loadURL('https://accounts.google.com')

});

Here is the link to the specification in their docs

like image 846
yaboiduke Avatar asked Oct 31 '22 00:10

yaboiduke


1 Answers

It's not used for autofilling, it's used for basic auth. When you get those annoying browser prompts for user and password.

How to display HTTP 401 basic authentication dialog

like image 83
Oded Breiner Avatar answered Nov 11 '22 05:11

Oded Breiner