How to integrate OAuth2.0 login with electron


i am newbie to electron and I am currently trying to implement an OAuth2.0 API which requires a callback URI. Url callback requires valid url ( so i tried this code snippet but does not work

// Your GitHub Applications Credentials
var options = {
    client_id: 'your_client_id',
    client_secret: 'your_client_secret',
    scopes: ["user:email", "notifications"] // Scopes limit access for OAuth tokens.

app.on('ready', () => {

// Build the OAuth consent page URL
var authWindow = new BrowserWindow({ width: 800, height: 600, show: false, 'node-integration': false });
var githubUrl = '';
var authUrl = githubUrl + 'client_id=' + options.client_id + '&scope=' + options.scopes;

function handleCallback (url) {

// Handle the response from GitHub - See Update from 4/12/2015

authWindow.webContents.on('will-navigate', function (event, url) {

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

// Reset the authWindow on close
authWindow.on('close', function() {
    authWindow = null;
}, false);

also i used angularjs route but does not work either.

so i am wondering if there is a way to run server inside electron app to serve app from url (https://localhost:3000) and if so how this will affect app behavior at packaging and distributing time, i means does the app will run from the same port
… any suggestions will help about how i can approach this problem. thank you