@@ -20,8 +20,7 @@ function githubUrl (path) {
20
20
}
21
21
22
22
passport . use ( new GithubStrategy ( {
23
- scope : ( config . github . organizations ?
24
- config . github . scopes . concat ( [ 'read:org' ] ) : config . github . scope ) ,
23
+ scope : ( config . github . organizations ? config . github . scopes . concat ( [ 'read:org' ] ) : config . github . scope ) ,
25
24
clientID : config . github . clientID ,
26
25
clientSecret : config . github . clientSecret ,
27
26
callbackURL : config . serverURL + '/auth/github/callback' ,
@@ -34,18 +33,20 @@ passport.use(new GithubStrategy({
34
33
}
35
34
const { statusCode, body : data } = await rp ( {
36
35
url : `https://api.github.com/user/orgs` ,
37
- method : 'GET' , json : true , timeout : 2000 ,
36
+ method : 'GET' ,
37
+ json : true ,
38
+ timeout : 2000 ,
38
39
headers : {
39
- ' Authorization' : `token ${ accessToken } ` ,
40
+ Authorization : `token ${ accessToken } ` ,
40
41
'User-Agent' : 'nodejs-http'
41
42
}
42
43
} )
43
- if ( statusCode != 200 ) {
44
+ if ( statusCode !== 200 ) {
44
45
return done ( InternalOAuthError (
45
46
`Failed to query organizations for user: ${ profile . username } `
46
47
) )
47
48
}
48
- const orgs = data . map ( ( { login} ) => login )
49
+ const orgs = data . map ( ( { login } ) => login )
49
50
for ( const org of orgs ) {
50
51
if ( config . github . organizations . includes ( org ) ) {
51
52
return passportGeneralCallback ( accessToken , refreshToken , profile , done )
0 commit comments