Git Product home page Git Product logo

passport-google-oauth2's People

Contributors

andrew avatar ashishtilara avatar blaine avatar ctesniere avatar iliakan avatar jaredhanson avatar jfromaniello avatar junajan avatar mkeating avatar mstade avatar phingage avatar robertpateii avatar terribleplan avatar timaschew avatar utkarshsingh99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

passport-google-oauth2's Issues

Google strategy not returning gender and birthay

this is my implementation and everything that I tried it will not return the gender and birthday as indicated in the documentation

GOOGLE_FIELDS='id,birthday,email,gender,family_name,given_name,locale,picture,profile'
GOOGLE_SCOPE='profile,email,openid,https://www.googleapis.com/auth/user.birthday.read,https://www.googleapis.com/auth/user.gender.read'

passport.use(new GoogleStrategy({
    clientID: process.env.GOOGLE_CLIENTID,
    clientSecret: process.env.GOOGLE_SECRET,
    callbackURL: process.env.GOOGLE_CALLBACK,
    profileFields: process.env.GOOGLE_FIELDS.split(','),
    passReqToCallback: true,
    enableProof: true,
  },
  (async (req, token, tokenSecret, profile, next) => {
    try {
      const addedParam = JSON.parse(req.query.state);
      const action = addedParam.action || 'l';
      const memberType = addedParam.member;
      const {
        id,
        family_name,
        given_name,
        email,
        gender, // always null
        birthday, // always null
        picture,
      } = profile;

am I doing something wrong or is this not implemented in this strategy, as I understand to get these fields from google documentation you need to make a call to the people api like so: https://people.googleapis.com/v1/people/me?personFields=genders,birthdays

Not able to successfully complete the call back

Hello,
I followed the steps given but as soon as i click on "Allow" after logging into my google account, it breaks with the below error:-

Error
at D:\ASU\SER 517\Oauth_mstade\passport-google-oauth2\example\node_modules\passport-google-oauth2\lib\oauth2.js:92:28
at passBackControl (D:\ASU\SER 517\Oauth_mstade\passport-google-oauth2\example\node_modules\oauth\lib\oauth2.js:132:9)
at IncomingMessage. (D:\ASU\SER 517\Oauth_mstade\passport-google-oauth2\example\node_modules\oauth\lib\oauth2.js:157:7)
at emitNone (events.js:110:20)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

Any idea whats going wrong here.

Thanks,
Abhishek Dutta

passport-google-oauth2 + Clustering + SessionStore

I am using strong-cluster-connect-store and strong-cluster-control npm modules to create an Express Cluster with Cross Cluster Session Storage.

So I have setup a LocalStrategy and a GoogleStrategy setup. And the LocalStrategy seems to be fine.
Once logged in on one worker, the others know of that session as well. However, when using the GoogleStrategy I only seem to be Authenticated for that worker.

My feeling is it is today with the store that is being used, internally. But I could be very much mistaken.

Any ideas/tips/tricks would be greatly appreciated.

refreshToken

Hi!
I am not able to access the refreshToken inside the 'new Strategy' callback function.
When logging in it does ask for offline access, and everything works, except for accessing the refreshtoken.

No OAuth2 ID_Token parameter in the callback function

I am using passport JS with backend, I have an android application and a react web client, I want to be able to sign in on both clients with the same method. For that I need to send ID Token to client but I can't a such workaround.
Screenshot from 2022-02-05 02-21-48

User is not showing up in my req

I run this code and I login with Google, but no user is stored in req, so when it redirects back to the index page, it still shows "Login" and NOT "account". Why/How can this be?

I put a breakpoint in my "function (request, accessToken, refreshToken, profile, done) {" and it shows profile is filled with data and so I "return done(null, profile)", but I can't access profile or user anywhere else

@natanbr yes, here what I'm currently doing:

@natanbr yes, here what I'm currently doing:

const passportGoogle = require('passport-google-oauth').OAuth2Strategy;

const computeConnectedUser = strategy => (req, accessToken, refreshToken, profile, done) => done(false, { strategy, accessToken, refreshToken, ...profile });

const googleStrategy = new passportGoogle({
    clientID: googleConfig.clientID,
    clientSecret: googleConfig.clientSecret,
    callbackURL: googleConfig.callbackURL,
    profileFields: googleConfig.profileFields,
    passReqToCallback: true,
}, computeConnectedUser('google'));

passport.use(googleStrategy);

router.all(googleConfig.connectURL, passport.authenticate('google', { authType: 'rerequest', accessType: 'offline', prompt: 'consent', includeGrantedScopes: true, scope: googleConfig.scope }));

router.all(googleConfig.callbackURL, passport.authenticate('google', { failureRedirect: googleConfig.connectURL, session: false }), oauthed);

Originally posted by @damianobarbati in #5 (comment)

Is the package stable?

I'm not sure if it's intentional or not but the fact that the package version is 0.y.z means that any change is considered a major semver change (https://semver.org/#spec-item-4) which interferes with automatic dependency management tools (like npm update) which tend to strictly follow semver. If you consider this package stable, please consider incrementing to version 1!

I got this message when google called callback

I tried to find the way to fix this and still no clue. I want to know what's going on
please help me
thank you

Error
at C:\Users\Admin-PC\Documents\Ecommerce-Cores\authentication\node_modules\passport-google-oauth2\lib\oauth2.js:92:28
at passBackControl (C:\Users\Admin-PC\Documents\Ecommerce-Cores\authentication\node_modules\oauth\lib\oauth2.js:132:9)
at IncomingMessage. (C:\Users\Admin-PC\Documents\Ecommerce-Cores\authentication\node_modules\oauth\lib\oauth2.js:157:7)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

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.