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

Checking organization member does not work correctly. #285

Open
Cicko opened this issue Jul 19, 2017 · 2 comments
Open

Checking organization member does not work correctly. #285

Cicko opened this issue Jul 19, 2017 · 2 comments

Comments

@Cicko
Copy link

Cicko commented Jul 19, 2017

I am using passport for authentication and when I want to check if the authenticated user is member of a github organization it always return a false. I was also trying to get all members of that organization and it only returns a ONE member. Here you see my code:

passport.use(new Strategy({
  clientID: oauth_file.clientID,
  clientSecret: oauth_file.clientSecret,
  callbackURL: oauth_file.callbackURL
},
function(accessToken, refreshToken, profile, done) {
  var org = require('./.config.book.json').organization;

  var client = github.client(accessToken);
  var ghorg = client.org(org);
  ghorg.member(profile.username, (err,result) =>
  {
    if(err) console.log(err);

    console.log("Result: " + result); // Always is FALSE
    if(result == true)
      done(null, profile);
    else
      done(null, null);
  });
}));

When I try to get all members doing this:

  ghorg.members((err, result) => {
    if (err) console.log(err);
    else console.log(result);
  })

It always returns only ONE member.

I was now investigating little and I can see that I can not see the other members because they are private.. So I have to be logged to my account and I imagine that with the accessToken returned by the Passport Strategy should be enought to be log in.

@pksunkara
Copy link
Owner

Unfortunately, I have no idea about passport usage and can't help you with debugging. Please update me if you find out the issue.

@Cicko
Copy link
Author

Cicko commented Jul 19, 2017

Ok. I will still looking for the solution. Thanks for the fast answering. Have a good day

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

2 participants