microsoft-identity-web
microsoft-identity-web copied to clipboard
Blazor server azure b2c redirect issue
Microsoft.Identity.Web Library
Microsoft.Identity.Web
Microsoft.Identity.Web version
2.18.1
Web app
Sign-in users and call web APIs
Web API
Protected web APIs (validating tokens)
Token cache serialization
In-memory caches
Description
Hi team,
Application: Blazor Server Render Mode: Interactive Sign-in through Azure B2C
I am trying to fetch the access token using token acquisition but it never completes.
Reproduction steps
- try to fetch the token using Itokenacquisition, providing the scope public async Task GetTokenAsync() { var accessToken = await _tokenAcquisition.GetAccessTokenForUserAsync(new[] { _myAppScope }); return accessToken; }
Error message
Microsoft.Identity.Web.TokenAcquisition: Information: [MsIdWeb] An error occured during token acquisition: No account or login hint was passed to the AcquireTokenSilent call.
MSAL.NetCore.4.60.3.0.MsalUiRequiredException: ErrorCode: user_null Microsoft.Identity.Client.MsalUiRequiredException: No account or login hint was passed to the AcquireTokenSilent call. at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync(CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass11_1.<b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func1 codeBlock) at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken) at Microsoft.Identity.Client.ApiConfig.Executors.ClientApplicationBaseExecutor.ExecuteAsync(AcquireTokenCommonParameters commonParameters, AcquireTokenSilentParameters silentParameters, CancellationToken cancellationToken) at Microsoft.Identity.Web.TokenAcquisition.GetAuthenticationResultForWebAppWithAccountFromCacheAsync(IConfidentialClientApplication application, ClaimsPrincipal claimsPrincipal, IEnumerable1 scopes, String tenantId, MergedOptions mergedOptions, String userFlow, TokenAcquisitionOptions tokenAcquisitionOptions) at Microsoft.Identity.Web.TokenAcquisition.GetAuthenticationResultForUserAsync(IEnumerable`1 scopes, String authenticationScheme, String tenantId, String userFlow, ClaimsPrincipal user, TokenAcquisitionOptions tokenAcquisitionOptions) StatusCode: 0 ResponseBody: Headers: Exception thrown: 'Microsoft.Identity.Web.MicrosoftIdentityWebChallengeUserException' in Microsoft.Identity.Web.TokenAcquisition.dll
Id Web logs
No response
Relevant code snippets
public async Task GetTokenAsync()
{
var accessToken = await _tokenAcquisition.GetAccessTokenForUserAsync(new[] { _myAppScope });
return accessToken;
}
Regression
Id Web 2.6.0
Expected behavior
Expected to get access token