Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/meteor/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ rocketchat:version

accounts-base@3.1.2
accounts-facebook@1.3.4
accounts-github@1.5.1
accounts-google@1.4.1
accounts-meteor-developer@1.5.1
accounts-oauth@1.4.6
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/.meteor/versions
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
accounts-base@3.1.2
accounts-facebook@1.3.4
accounts-github@1.5.1
accounts-google@1.4.1
accounts-meteor-developer@1.5.1
accounts-oauth@1.4.6
Expand Down Expand Up @@ -35,7 +34,6 @@ facebook-oauth@1.11.6
facts-base@1.0.2
fetch@0.1.6
geojson-utils@1.0.12
github-oauth@1.4.2
google-oauth@1.4.5
hot-code-push@1.0.5
http@3.0.0
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/app/github/server/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './lib';
19 changes: 19 additions & 0 deletions apps/meteor/app/github/server/lib.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { OauthConfig } from '@rocket.chat/core-typings';

import { CustomOAuth } from '../../custom-oauth/server/custom_oauth_server';

const config: OauthConfig = {
serverURL: 'https://github.com',
identityPath: 'https://api.github.com/user',
tokenPath: 'https://github.com/login/oauth/access_token',
scope: 'user:email',
mergeUsers: false,
addAutopublishFields: {
forLoggedInUser: ['services.github'],
forOtherUsers: ['services.github.username'],
},
accessTokenParam: 'access_token',
identityTokenSentVia: 'header',
};

export const Github = new CustomOAuth('github', config);
44 changes: 0 additions & 44 deletions apps/meteor/client/meteor/login/github.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/meteor/client/meteor/login/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import './cas';
import './crowd';
import './facebook';
import './github';
import './google';
import './ldap';
import './meteorDeveloperAccount';
Expand Down
2 changes: 2 additions & 0 deletions apps/meteor/client/views/root/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useDolphinOAuth } from './hooks/customOAuth/useDolphinOAuth';
import { useDrupalOAuth } from './hooks/customOAuth/useDrupalOAuth';
import { useGitHubEnterpriseOAuth } from './hooks/customOAuth/useGitHubEnterpriseOAuth';
import { useGitLabOAuth } from './hooks/customOAuth/useGitLabOAuth';
import { useGithubOAuth } from './hooks/customOAuth/useGithubOAuth';
import { useNextcloudOAuth } from './hooks/customOAuth/useNextcloudOAuth';
import { useWordPressOAuth } from './hooks/customOAuth/useWordPressOAuth';
import { useAnalytics } from './hooks/useAnalytics';
Expand Down Expand Up @@ -56,6 +57,7 @@ const AppLayout = () => {
useLivechatEnterprise();
useNextcloudOAuth();
useGitLabOAuth();
useGithubOAuth();
useGitHubEnterpriseOAuth();
useDrupalOAuth();
useDolphinOAuth();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { OauthConfig } from '@rocket.chat/core-typings';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';

import { CustomOAuth } from '../../../../lib/customOAuth/CustomOAuth';

const config: OauthConfig = {
authorizePath: 'https://github.com/login/oauth/authorize',
serverURL: 'https://github.com',
identityPath: 'https://api.github.com/user',
tokenPath: 'https://github.com/login/oauth/access_token',
scope: 'user:email',
mergeUsers: false,
addAutopublishFields: {
forLoggedInUser: ['services.github'],
forOtherUsers: ['services.github.username'],
},
accessTokenParam: 'access_token',
} as const satisfies OauthConfig;

const Github = CustomOAuth.configureOAuthService('github', config);

export const useGithubOAuth = () => {
const enabled = useSetting('Accounts_OAuth_Github');

useEffect(() => {
if (enabled) {
Github.configure({
...config,
});
}
}, [enabled]);
};
3 changes: 0 additions & 3 deletions apps/meteor/definition/externals/meteor/github-oauth.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions apps/meteor/server/importPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ import '../app/ui-utils/server';
import '../app/reactions/server';
import '../app/livechat/server';
import '../app/authentication/server';
import '../app/github/server';
Loading