I noticed that the https://github.com/jaredhanson/passport-github module supports OAuth v2 but hasn't been updated for awhile. Does anyone know whether it will be updated to support the current Github OAuth v3 APIs? Specifically I'm looking for a way to easily add the scopes list (similar to what https://github.com/pksunkara/octonode supports) as well as pass in the state for CSRF verification.
1 Answer
You are confusing two different things, passport-github supports OAuth 2 which is the version of the OAuth protocol while Github API is in version 3.
With passport-github you can use scope and state as follow:
app.get('/auth/github', passport.authenticate('github', {
scope: ['user', 'repo'],
state: 'foobar'
}));
3 Comments
Edward Tan
Thanks for the example, which I was not able to find on the project page or login code.
Kevin Suttle
Can you elaborate here? I'm stuck in the same boat. github.com/jaredhanson/passport-github/issues/22
Ido.Co
@kevinSuttle probably not relevant anymore, but for future readers - it seems that you need to also/only pass the scope array to the Strategy constructor (where you pass the secrets and the callback)