Skip to content

Instantly share code, notes, and snippets.

@bkonkle
Created November 27, 2016 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bkonkle/d2c98c09dd35d5071b0238e502fc8cfb to your computer and use it in GitHub Desktop.
Save bkonkle/d2c98c09dd35d5071b0238e502fc8cfb to your computer and use it in GitHub Desktop.
Electron Google Authentication - Part 3
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