I'm trying to implement google sign-in/ sign-up for my web app but I'm getting the following error:
GooglePlusAPIError: Project [project#] is not found and cannot be used for API calls.
This is my auth setup:
'googleAuth' : {
'clientID' : '***********',
'clientSecret' : '***********',
'callbackURL' : 'http://localhost:8080/auth/google/callback'
}
I've created the app on the google developer console and set the redirect URI to the same as that mentioned in the above auth setup. For good measure, here's my strategy for google signup:
passport.use(new GoogleStrategy({
clientID : configAuth.googleAuth.clientID,
clientSecret : configAuth.googleAuth.clientSecret,
callbackURL : configAuth.googleAuth.callbackURL,
},
function(token, refreshToken, profile, done) {
process.nextTick(function() {
User.findOne({ 'google.id' : profile.id }, function(err, user) {
if(err)
return done(err);
if(user) {
// if a user is found log them in
return done(null, user);
} else {
// if no user, create it
var newUser = new User();
newUser.google.id = profile.id;
newUser.google.token = token;
newUser.google.name = profile.displayName;
newUser.google.email = profile.emails[0].value;
//save user
newUser.save(function(err) {
if(err)
throw err;
return done(null, newUser);
});
}
});
});
}));
I've trawled the internet for answers and find nothing at all. Can anybody help?
Confirm the version of this library that you are using:
https://github.com/jaredhanson/passport-google
The latest version of this library does not accept these options.
See snippet from documentation below:
* Options:
* - `returnURL` URL to which Google will redirect the user after authentication
* - `realm` the part of URL-space for which an OpenID authentication request is valid
* - `profile` enable profile exchange, defaults to _true_
*
* Examples:
*
* passport.use(new GoogleStrategy({
* returnURL: 'http://localhost:3000/auth/google/return',
* realm: 'http://localhost:3000/'
* },
* function(identifier, profile, done) {
* User.findByOpenID(identifier, function (err, user) {
* done(err, user);
* });
* }
* ));