new(core.gbapp): #387 adding /setupSecurity multiple tokens.

This commit is contained in:
Rodrigo Rodriguez 2023-11-17 15:24:05 -03:00
parent db21ad6574
commit 863591741d

View file

@ -510,10 +510,10 @@ export class GBMinService {
const authenticationContext = new AuthenticationContext.AuthenticationContext(
urlJoin(
tokenName? host: min.instance.authenticatorAuthorityHostUrl,
tokenName? tenant: min.instance.authenticatorTenant)
tokenName ? host : min.instance.authenticatorAuthorityHostUrl,
tokenName ? tenant : min.instance.authenticatorTenant)
);
const resource = 'https://graph.microsoft.com';
const resource = tokenName ? '' : 'https://graph.microsoft.com';
// Calls MSFT to get token.
@ -521,13 +521,16 @@ export class GBMinService {
req.query.code,
urlJoin(process.env.BOT_URL, min.instance.botId, '/token'),
resource,
tokenName? clientId: instance.marketplaceId,
tokenName? clientSecret: instance.marketplacePassword,
tokenName ? clientId : instance.marketplaceId,
tokenName ? clientSecret : instance.marketplacePassword,
async (err, token) => {
if (err) {
const msg = `handleOAuthTokenRequests: Error acquiring token: ${err}`;
GBLog.error(msg);
res.send(msg);
} else {
// Saves token to the database.
@ -1507,7 +1510,7 @@ export class GBMinService {
}
);
}
else{
else {
resolve(true);
GBLogEx.info(0, 'Loading General Bots API...');
}
@ -1526,9 +1529,9 @@ export class GBMinService {
const f = new Function()
dialogs[script] = async (data)=> {
dialogs[script] = async (data) => {
let params;
if (data){
if (data) {
params = JSON.parse(data);
}