Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
Implementing google auth using passport - error

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?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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);
 *         });
 *       }
 *     ));
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!