Webview basic auth


#1

How to handle a basic auth with a tag?

Thanks!


#2

You can try below code in main process if you know username and pass

app.on('login', function(event, webContents, request, authInfo, callback) {
  event.preventDefault();
  callback('username', 'secret');
})

or using ntlm auth for ldap/kerbros

app.on('ready', function() {

    const electron = require('electron');
    const {app, BrowserWindow} = electron;
    const {width, height} = electron.screen.getPrimaryDisplay().workAreaSize;//we can get primary display only if app is ready
    app.commandLine.appendSwitch ('ignore-certificate-errors', 'true');
    session.defaultSession.allowNTLMCredentialsForDomains('*');//to allow sso/kerbors authentication
    win  = new BrowserWindow({
        icon:__dirname+'/resources/images/umt.png',
        width: width, height: height,
        movable:true, frame: false,
        allowDisplayingInsecureContent: true,
        experimentalFeatures:false,
        experimentalCanvasFeatures:false,
        offscreen:true,
        webaudio:false
    });