GithubHelp home page GithubHelp logo

Comments (4)

toadkicker avatar toadkicker commented on May 8, 2024
app.get('/auth/google',
        passport.authenticate('google', { scope: scope }),
            function(req, res) {
                /* do nothing as this request will be redirected to google for authentication */
            }
    );

from passport-google-oauth2.

brannonh avatar brannonh commented on May 8, 2024

I'm getting this same error, and I can't find answers anywhere. I'm passing the desired scope to passport.authenticate(), as described by @toadkicker. Here is the line in my app:

api.get('/auth/google', passport.authenticate('google', { scope: auth.google.scope }));

If I change the desired scope, it is reflected on the deny/allow page, so it seems the scope is being sent. The error shows up after Allow is selected.

Any help would be greatly appreciated.

from passport-google-oauth2.

brannonh avatar brannonh commented on May 8, 2024

Figured I should add the return route also.

api.get('/auth/google/return', passport.authenticate('google', { failureRedirect: '/hello/fail', successRedirect: '/hello/succeed' });

Seems this is actually where the error is occurring. If I comment out that line, the request comes back from Google to '/auth/google/return'. So, is Passport redirecting back to the Google error page?

from passport-google-oauth2.

brannonh avatar brannonh commented on May 8, 2024

Forgot to come back here. Seems it was an issue with the way I was setting up my Restify server. I was able to fix this by adding the following code after initializing the server:

api.use(restify.plugins.queryParser({ mapParams: false }));

Once I added that line, I no longer saw the Google error, and the process passed back to my code.

from passport-google-oauth2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.