apps/meteor/app/tokenpass/server/lib.ts
import type { OauthConfig } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';
import { CustomOAuth } from '../../custom-oauth/server/custom_oauth_server';
import { settings } from '../../settings/server';
const config: OauthConfig = {
serverURL: '',
identityPath: '/oauth/user',
authorizePath: '/oauth/authorize',
tokenPath: '/oauth/access-token',
scope: 'user',
tokenSentVia: 'payload',
usernameField: 'username',
mergeUsers: true,
addAutopublishFields: {
forLoggedInUser: ['services.tokenpass'],
forOtherUsers: ['services.tokenpass.name'],
},
accessTokenParam: 'access_token',
};
const Tokenpass = new CustomOAuth('tokenpass', config);
Meteor.startup(() => {
settings.watch<string>('API_Tokenpass_URL', (value) => {
config.serverURL = value;
Tokenpass.configure(config);
});
});