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