Created
July 9, 2019 08:05
-
-
Save christianstrang/e5342f28a85711dd5bbc64276f2adae2 to your computer and use it in GitHub Desktop.
SailsJS GoogleStrategy for Passport
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
'use strict'; | |
var passport = require('passport'), | |
GoogleStrategy = require('passport-google-oauth20').Strategy; | |
//var verifyHandler = function(req, token, tokenSecret, profile, done) { | |
var verifyHandler = function (accessToken, refreshToken, profile, cb, done) { | |
var data = { | |
id: cb.id, | |
name: cb.displayName, | |
email: cb.emails[0].value, | |
emailVerified: cb.emails[0].verified | |
}; | |
return done(null, data); | |
}; | |
passport.use(new GoogleStrategy({ | |
clientID: YOUR_CLIENT_ID, | |
clientSecret: YOUR_CLIENT_SECRET, | |
callbackURL: 'http://localhost:1337/api/v1/auth/google/callback', | |
passReqToCallback: true | |
}, verifyHandler)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment