Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it still work? #33

Open
bouchtaoui-dev opened this issue Nov 11, 2020 · 4 comments
Open

Does it still work? #33

bouchtaoui-dev opened this issue Nov 11, 2020 · 4 comments

Comments

@bouchtaoui-dev
Copy link

Hello friends,

Somehow the passport-google-id-token package doesn't work for me. I'm a bit new to node.js but I am an experienced programmer on another field.

Why is (parsedToken, googleId, done) => {} not called? I hope you can help me.

passport-setup.js

const passport = require('passport');
const GoogleTokenStrategy = require('passport-google-id-token');
...
...

passport.use(new GoogleTokenStrategy({
    clientID: "3530000000-xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"
  }, (parsedToken, googleId, done) => {
      console.log('Google callback token!')   // <-- not called here
    done({}, {});
  }
));

login.js

router.post('/google/token', passport.authenticate('google-id-token'), (req, res) => {
    res.send({
        tokenid: 'GOOGLE TOKEN ID'
    });
});

Any idea?

@magp3
Copy link

magp3 commented Dec 21, 2020

@Nordin-010
Yes I managed to get this library to work.
Actually in your login.js you should actually send the id token from the client and then this library just verifies the token for you.
I'm not sure if that's what you're trying to do

@bouchtaoui-dev
Copy link
Author

Thnx @magp3 . I finally used the Google's own variation:
Google Auth2.0

and that works for me perfectly. But I'm not using passport lib.
Maybe next time I manage to get it work :)

@Math-O5
Copy link

Math-O5 commented Jul 27, 2022

@magp3 Can you desbribe better how perfome a request?A always get 404. I tried pass a json in body with "idToken" and the idToken.

@ferdinandyb
Copy link
Contributor

Its id_token see here:

var idToken = (req.body && (req.body.id_token || req.body.access_token))

But if you're getting a 404 the problem might be elsewhere since passport should be giving back 401. And yes this is still working, I have it in a live project so I think this issue should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants