The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I have a UserOwnsData using .Net 6.
Problem/Scenario
Everything works when accesing the UserOwnsData directly et. localhost:5001 and the reports shows
The UserOwnsData app is shown on our web via the Iframe but upon successfull sign-in via the pop-up window
Issue is that on the web client after the user signs in to microsoft and the pop-up closes.
This error shows on the terminal thereby not displaying the report on the web client(Full error log shown on pic)
any help is appreciated on figuring this out.
PS: sorry for not using the code block had trouble using it unable to post the codes
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
An unhandled exception has occurred while executing the request.
Microsoft.Identity.Web.MicrosoftIdentityWebChallengeUserException: IDW10502: An MsalUiRequiredException was thrown due to a challenge for the user. See https://aka.ms/ms-id-web/ca_incremental-consent.
---> MSAL.NetCore.4.19.0.0.MsalUiRequiredException:
ErrorCode: user_null
This is the part of the webApp
<template>
<Head title="Report" />
<BreezeAuthenticatedLayout>
<div class="h-screen">
<iframe :src="iframeSrc" class="h-full w-full"></iframe>
</div>
</BreezeAuthenticatedLayout>
</template>
<script>
export default {
computed: {
iframeSrc() {
return 'https://localhost:5001'; // Deployed on my local machine for development and faster debug
}
},
}
</script>
<div class="overlay">
<div class="signin-container">
<p>Sign in to Power BI</p>
<button class="sign-in" onclick="signIn()">Sign in</button>
</div>
</div>
<script>
function signIn() {
// Open the sign-in window in a pop-up
const signInWindow = window.open("@Url.Action("Login", "Home")", "_blank", "width=600,height=600");
// Check if the pop-up window is closed every 500 milliseconds
const checkWindowClosed = setInterval(function () {
if (signInWindow && signInWindow.closed) {
clearInterval(checkWindowClosed);
console.log("Pop-up window closed");
window.location.href = "@Url.Action("Embed", "Home")";
} else {
console.log("Pop-up window still open");
}
}, 500);
}
</script>
This is a part of the HomeController code of the server that handles the pop-up login
[AllowAnonymous]
public IActionResult Login()
{
//return Challenge(new AuthenticationProperties { RedirectUri = Url.Action("ClosePopUp") });
return Challenge();
}
[AllowAnonymous]
public IActionResult ClosePopUp()
{
return Content("<script>window.close();</script>", "text/html");
}
[AllowAnonymous]
public async Task<IActionResult> Embed()
{
AuthDetails authDetails = await SignInAndGetAuthDetails();
return View(authDetails);
}
private async Task<AuthDetails> SignInAndGetAuthDetails()
{
// Generate token for the signed-in user
var accessToken = await m_tokenAcquisition.GetAccessTokenForUserAsync(Configuration["AzureAd:Scopes:0"].Split(" "));
// Get username of logged-in user
var userInfo = await m_graphServiceClient.Me.Request().GetAsync();
var userName = userInfo.DisplayName;
AuthDetails authDetails = new AuthDetails
{
UserName = userName,
AccessToken = accessToken
};
return authDetails;
}
UserOwnsData Successfully displayed on web app
Did not include the pop-up due to accounts being shown but this is the part where the user has successfully login and the pop-up closes which shows error 500 which means error on the UserOwnsData
This is the full error log
Hi @JanRV,
>>IDW10502: An MsalUiRequiredException was thrown due to a challenge for the user.
This error messages seems need to provide additional authentication information to complete the request.
For this scenario, I'd like to suggest you check the authentication parts of the requests and try to sign in again with vailed authentications.
In addition, please also check the accounts if they are still active and ensure they have enough permissions to access the resource.
Regards,
Xiaoxin Sheng
User | Count |
---|---|
6 | |
4 | |
3 | |
2 | |
2 |
User | Count |
---|---|
9 | |
7 | |
6 | |
5 | |
4 |