Skip to content

Commit

Permalink
✨ feat: added Github Enterprise SSO login (#5621)
Browse files Browse the repository at this point in the history
* #2812

* refactored the code to simplify it.

* removed unneeded code

* removed unneeded code
  • Loading branch information
rubentalstra authored Feb 3, 2025
1 parent 93f5713 commit 7c8a930
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ FACEBOOK_CALLBACK_URL=/oauth/facebook/callback
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=/oauth/github/callback
# GitHub Eenterprise
# GITHUB_ENTERPRISE_BASE_URL=
# GITHUB_ENTERPRISE_USER_AGENT=

# Google
GOOGLE_CLIENT_ID=
Expand Down
2 changes: 1 addition & 1 deletion api/server/socialLogins.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ const configureSocialLogins = (app) => {
}
};

module.exports = configureSocialLogins;
module.exports = configureSocialLogins;
9 changes: 9 additions & 0 deletions api/strategies/githubStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ module.exports = () =>
callbackURL: `${process.env.DOMAIN_SERVER}${process.env.GITHUB_CALLBACK_URL}`,
proxy: false,
scope: ['user:email'],
...(process.env.GITHUB_ENTERPRISE_BASE_URL && {
authorizationURL: `${process.env.GITHUB_ENTERPRISE_BASE_URL}/login/oauth/authorize`,
tokenURL: `${process.env.GITHUB_ENTERPRISE_BASE_URL}/login/oauth/access_token`,
userProfileURL: `${process.env.GITHUB_ENTERPRISE_BASE_URL}/api/v3/user`,
userEmailURL: `${process.env.GITHUB_ENTERPRISE_BASE_URL}/api/v3/user/emails`,
...(process.env.GITHUB_ENTERPRISE_USER_AGENT && {
userAgent: process.env.GITHUB_ENTERPRISE_USER_AGENT,
}),
}),
},
githubLogin,
);
2 changes: 1 addition & 1 deletion api/strategies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ module.exports = {
facebookLogin,
setupOpenId,
ldapLogin,
};
};

0 comments on commit 7c8a930

Please sign in to comment.