new(core.gbapp): #387 adding /setupSecurity multiple tokens.
This commit is contained in:
parent
db21ad6574
commit
863591741d
1 changed files with 22 additions and 19 deletions
|
@ -503,17 +503,17 @@ export class GBMinService {
|
|||
throw new Error(msg);
|
||||
}
|
||||
|
||||
const clientId = min.core.getParam<string>(min.instance, `${tokenName} Client ID`, null),
|
||||
const clientSecret = min.core.getParam<string>(min.instance, `${tokenName} Client Secret`, null),
|
||||
const clientId = min.core.getParam<string>(min.instance, `${tokenName} Client ID`, null),
|
||||
const clientSecret = min.core.getParam<string>(min.instance, `${tokenName} Client Secret`, null),
|
||||
const host = min.core.getParam<string>(min.instance, `${tokenName} Host`, null),
|
||||
const tenant = min.core.getParam<string>(min.instance, `${tokenName} Tenant`, null)
|
||||
|
||||
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,15 +1529,15 @@ 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);
|
||||
}
|
||||
|
||||
await GBVMService.callVM(script, min, null, null, null, false, params);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const proxy = {
|
||||
dk: new DialogKeywords(),
|
||||
|
|
Loading…
Add table
Reference in a new issue