Last active
October 9, 2018 15:28
-
-
Save xurwy/6ef55ccd9f92b67d0e0b568c8ec53673 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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