Using Keycloak with Electron

Hey everyone.

Does someone of you have a working example, how to use the standard flow within an electron app?

I cannot find a fully working example. Maybe it is a little bit difficult, because of the electron architecture with the main and renderer process.

What I already did, without any success:

let authWindow = new BrowserWindow({
    width: WINDOW_WIDTH,
    height: WINDOW_HEIGHT,
    show: false,
    parent: mainWindow,
    modal: true,

    webPreferences: {
        nodeIntegration: false

authWindow.webContents.on('did-finish-load', function () {;

authWindow.webContents.on('did-get-redirect-request', function(event, oldUrl, newUrl) {
    console.log('oldUrl', oldUrl)
    console.log('newUrl', newUrl)

const {session: {webRequest}} = authWindow.webContents;

const filter = {
    urls: [

webRequest.onBeforeRequest(filter, async ({url}) => {
     console.log('baam', url)

Best regards

I also have this problem. I am trying to follow the description here but I can’t seem to grasp how the two pieces come together. Especially difficult is how to deal with the redirects.