Skip to content

Instantly share code, notes, and snippets.

@xurwy
Last active October 9, 2018 15:28
Show Gist options
  • Select an option

  • Save xurwy/6ef55ccd9f92b67d0e0b568c8ec53673 to your computer and use it in GitHub Desktop.

Select an option

Save xurwy/6ef55ccd9f92b67d0e0b568c8ec53673 to your computer and use it in GitHub Desktop.
const express = require('express');
const passport = require('passport');
const GoogleStrategy = require('passport-google-oauth20').Strategy;
const keys = require('./config/key')
const app = express();
passport.use(new GoogleStrategy(
{
clientID: keys.googleClientID,
clientSecret: keys.googleClientSecret,
callbackURL: '/auth/google/callback'
},
accessToken => {
console.log(accessToken);
}
));
app.get('/auth/google',
passport.authenticate('google', {
scope: ["profile", "email"]
})
)
app.get('/auth/google/callback', passport.authenticate('google'))
const PORT = process.env.PORT || 5000
app.listen(PORT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment