shikha_taksande
Scholar

Microsoft Identity token in Broker

Hi,

 

I am trying to implement a broker which should be able to get the token using Client Id and Tenant Id and then will invoke other REST apis. K2 form is anonymous so I can't get user details from the K2 service. 

My requirement is that while calling a broker method, token should be generated and only then it will return result from REST apis. I am using Microsoft Identity framework to get the token and below is the code --

 

 var accounts = await app.GetAccountsAsync(); AuthenticationResult authResult; try { authResult = await app.AcquireTokenSilent(scopes, accounts.FirstOrDefault()).ExecuteAsync(); } catch (MsalUiRequiredException) { authResult = await app.AcquireTokenInteractive(scopes) .WithPrompt(Prompt.SelectAccount) .ExecuteAsync(); } 

 

 The code gives me error in AcquireTokenInteractive() that "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation" which ,I understood, is due to the fact that K2 runs on IIS server hence a prompt message to enter username cant be displayed. Please pour in suggestions if you know how can I resolve this .

 

 

 

 

 

 

Labels: (1)
0 Kudos
Reply