electron-google-oauth2 icon indicating copy to clipboard operation
electron-google-oauth2 copied to clipboard

Close browser window after sign in

Open scriptPilot opened this issue 4 years ago • 2 comments

After sign in, the browser window should redirect to the local server and should be closed automatically.

scriptPilot avatar Dec 11 '21 14:12 scriptPilot

I helped myself by modifying the LoopbackRedirectServer.js file:

if (req.url && url.parse(req.url).pathname === callbackPath) {                  

    // Show message after sign in instead of forwarding to another website
    res.end('Google sign in successful. You can close this browser window.')
    /*
    res.writeHead(302, {
        Location: successRedirectURL,
    });
    res.end();
    */

    resolve(url.resolve(`http://127.0.0.1:${port}`, req.url));
    this._server.close();
}

scriptPilot avatar Dec 11 '21 18:12 scriptPilot

While we are on electron there is no necessity on redirecting to other website. So I am creating a pull request to add this feature.

abrshdir avatar Nov 01 '22 13:11 abrshdir