The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/tokenpass/lib/common.js

41 lines
1.0 KiB

import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { settings } from '../../settings';
import { CustomOAuth } from '../../custom-oauth';
const config = {
serverURL: '',
identityPath: '/oauth/user',
authorizePath: '/oauth/authorize',
tokenPath: '/oauth/access-token',
scope: 'user,tca,private-balances',
tokenSentVia: 'payload',
usernameField: 'username',
mergeUsers: true,
addAutopublishFields: {
forLoggedInUser: ['services.tokenpass'],
forOtherUsers: ['services.tokenpass.name'],
},
accessTokenParam: 'access_token',
};
const Tokenpass = new CustomOAuth('tokenpass', config);
if (Meteor.isServer) {
Meteor.startup(function() {
settings.get('API_Tokenpass_URL', function(key, value) {
config.serverURL = value;
Tokenpass.configure(config);
});
});
} else {
Meteor.startup(function() {
Tracker.autorun(function() {
if (settings.get('API_Tokenpass_URL')) {
config.serverURL = settings.get('API_Tokenpass_URL');
Tokenpass.configure(config);
}
});
});
}