Tim Morrison
Tim Morrison

Reputation: 428

Azure B2C AD / dotnetcore 2.0 MVC app not authorising

I've followed the tutorial at https://blogs.msdn.microsoft.com/webdev/2017/10/17/user-accounts-made-easy-with-azure/#comment-312956 and am reasonably confident that I have set up my Azure B2C Tenant correctly - I have tested the login functionality through the Azure Portal, and all is good.

However, using the demo app, I am unable to sign in. I don't get any errors, and I can see through the browser dev tools that the request goes off to the portal, but it returns almost immediately without giving me the login page, and my app is still in the "sign in" state. Here's a screenshot of the network activity (FirefoxDeveloper)

developer tools activity

There are no login activities recorded in the B2C portal and there are no errors anywhere...Any help would be gratefully received!

Upvotes: 1

Views: 76

Answers (2)

Paul Hatcher
Paul Hatcher

Reputation: 8156

The callback path is set in the OpenIdConnectOptions instance and defaults to "signin-oidc", e.g. taking the sample code

public void Configure(string name, OpenIdConnectOptions options)
{
    options.ClientId = AzureAdB2COptions.ClientId;
    options.Authority = AzureAdB2COptions.Authority;
    // This is the default value
    options.CallbackPath = "signin-oidc";
    options.UseTokenLifetime = true;
    options.TokenValidationParameters = new TokenValidationParameters() { NameClaimType = "name" };

    options.Events = new OpenIdConnectEvents()
    {
        OnRedirectToIdentityProvider = OnRedirectToIdentityProvider,
        OnRemoteFailure = OnRemoteFailure,
        OnAuthorizationCodeReceived = OnAuthorizationCodeReceived
    };
}

Whatever you set this to, you must align the ReplyUri in your Azure B2C tenant e.g.

http://myapp.com/signin-oidc

Upvotes: 0

Tim Morrison
Tim Morrison

Reputation: 428

found the problem. The walkthrough for creating the B2C application does not mention that you need to append "/signin-oidc" to the Reply URL

Upvotes: 1

Related Questions