[Bug] Looping redirect with Azure Signalr Service
See original GitHub issueWhich version of Microsoft Identity Web are you using? Microsoft.Identity.Web (0.4.0-preview)
Where is the issue?
- Web app [X] Sign-in users and call web APIs
Is this a new or an existing app? This is a new app or an experiment.
Repro This sample app demonstrates the bug and uses Microsoft.Identity.Web, Blazor Server, Azure Signalr Service and Microsoft Graph: https://github.com/jassent/Example-Blazor-Graph-Microsoft-Identity-Web/tree/master/tests/BlazorServerCallsGraph
The goal is to add Azure Signalr Service. Adding the following code to startup.cs causes an endless looping redirect when calling Microsoft Graph once the Blazor Server app is using Azure Signalr Service.
services.AddSignalR().AddAzureSignalR();
Expected behavior The expected behavior is to be able to use Microsoft.Identity.Web in a Blazor Server web app that uses Microsoft Azure Signalr Service.
Actual behavior
Build the app and visit: https://localhost:44314/showprofile
Web App works fine when Blazor Server is run self-hosted. Migrating the Web App to Azure Signalr Service causes the problem. Adding “services.AddSignalR().AddAzureSignalR();” to Startup.cs causes the web page calling the Graph Api to continuously reload repeatedly calling https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token
There is an exception thrown in the visual studio debug window but no meaningful information: Exception thrown: ‘Microsoft.Graph.ServiceException’ in System.Private.CoreLib.dll System.Net.Http.HttpClient.Default.LogicalHandler: Information: Start processing HTTP request POST https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token
System.Net.Http.HttpClient.Default.ClientHandler: Information: Sending HTTP request POST https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token
System.Net.Http.HttpClient.Default.ClientHandler: Information: Received HTTP response after 201.8975ms - OK
System.Net.Http.HttpClient.Default.LogicalHandler: Information: End processing HTTP request after 209.1404ms - OK
The browser shows this error in the console window: blazor.server.js:19 [2020-09-12T12:35:54.880Z] Error: Circuit has been shut down due to error.
Graph Api data is returned to the application between each login loop.
Additional context / logs / screenshots Prior versions of the library 0.2.1-preview would produce a different error. The 0.2.1-preview version would allow the web app to call Graph Api, not cause a looping redirect but then would give a system exception (after a successful call to Graph Api) due to a null being returned from _tokenAcquisition.GetAccessTokenForUserAsync(_initialScopes)
Issue Analytics
- State:
- Created 3 years ago
- Comments:13
Top GitHub Comments
@jennyf19, after adding services.AddTokenAcquisition(false); there is no looping redirect. Instead there is this error: “InvalidOperationException: Cannot resolve scoped service ‘Microsoft.Identity.Web.ITokenAcquisition’ from root provider.”
@jmprieur & @jennyf19, thank you! Will give it a try in the next few days. I appreciate the work and the follow-up communication.