如何在Electron Framework中使用登录事件? [英] How do I use the Login Event in Electron Framework?

查看:77
本文介绍了如何在Electron Framework中使用登录事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对理解Electron Framework中的 Event:'login'功能如何工作有所帮助.这是浏览器中常见的密码自动填充/记住密码功能的低级实现吗?我想用它来自动在网页的登录流程中填充密码,例如

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')

});

此处是他们文档中规范的链接

推荐答案

它不用于自动填充,它用于基本身份验证.当您收到那些烦人的浏览器提示时,输入用户名和密码.

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

如何显示HTTP 401基本身份验证对话框

这篇关于如何在Electron Framework中使用登录事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆