Created
November 27, 2016 23:46
-
-
Save bkonkle/d2c98c09dd35d5071b0238e502fc8cfb to your computer and use it in GitHub Desktop.
Electron Google Authentication - Part 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handleNavigation (url) { | |
const query = parse(url, true).query | |
if (query) { | |
if (query.error) { | |
reject(new Error(`There was an error: ${query.error}`)) | |
} else if (query.code) { | |
// Login is complete | |
authWindow.removeAllListeners('closed') | |
setImmediate(() => authWindow.close()) | |
// This is the authorization code we need to request tokens | |
resolve(query.code) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment