import { Meteor } from 'meteor/meteor'; import type { OauthConfig } from '@rocket.chat/core-typings'; import { CustomOAuth } from '../../custom-oauth/server/custom_oauth_server'; import { settings } from '../../settings/server'; // GitHub Enterprise Server CallBack URL needs to be http(s)://{rocketchat.server}[:port]/_oauth/github_enterprise // In RocketChat -> Administration the URL needs to be http(s)://{github.enterprise.server}/ const config: OauthConfig = { serverURL: '', identityPath: '/api/v3/user', authorizePath: '/login/oauth/authorize', tokenPath: '/login/oauth/access_token', addAutopublishFields: { forLoggedInUser: ['services.github-enterprise'], forOtherUsers: ['services.github-enterprise.username'], }, }; const GitHubEnterprise = new CustomOAuth('github_enterprise', config); Meteor.startup(function () { settings.watch('API_GitHub_Enterprise_URL', function (value) { config.serverURL = value; GitHubEnterprise.configure(config); }); });