简体   繁体   English

如何在 Electron 框架中使用登录事件?

[英]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.我需要一些帮助来了解 Electron 框架中的Event: 'login'功能是如何工作的。 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 eg我想用它来自动填充网页登录流程中的密码,例如

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这是他们文档中规范的链接

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 如何显示 HTTP 401 基本身份验证对话框

It can also be used to support Proxies on a Corporate network.它还可用于支持企业网络上的代理。 eg Basic, NTLM, etc. This'd be in response to a 407.例如 Basic、NTLM 等。这将是对 407 的响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM