1

I'm trying to authorize a Xamarin Forms app to communicate with a SignalR hub in a ASP.NET Core Blazor Server app with Azure AD B2C configured. Login functionality in Xamarin Forms as well as in ASP.NET Core Blazor Server app is working fine with Azure AD B2C, but I'm not able to use [Authorize] on SignalR hub. I have tried to pass access token received from Azure AD B2C to HubConnectionBuilder as follows.

connection = new HubConnectionBuilder().
            WithAutomaticReconnect().
            WithUrl(Location + Name, options => { options.AccessTokenProvider = () => Task.FromResult(AccessToken); }).
            Build();

1 Answer 1

1

Adding following to Startup.cs in ASP.NET Core Blazor app solved the issue. I also used this authentication scheme to authorize the SignalR hub.

.AddAzureADB2CBearer(options => Configuration.Bind("AzureAdB2C", options));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.