Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refused to connect. /sign-oidc #76

Open
ravisankarnbr opened this issue Dec 12, 2024 · 0 comments
Open

Refused to connect. /sign-oidc #76

ravisankarnbr opened this issue Dec 12, 2024 · 0 comments

Comments

@ravisankarnbr
Copy link

ravisankarnbr commented Dec 12, 2024

In my .NET blazer application, the after successful authentication using Azure B2C (azure sign-in log shows 'Success') , the error page is returned with the URL https://localhost: /signin-oidc

Screenshot

image

Unfortunately, there are no logs to illuminate the cause of the error.

`services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(options =>
{
options.RemoteAuthenticationTimeout = TimeSpan.FromSeconds(10);
builder.Configuration.Bind("OpenIDConnect", options);

    options.Events = new OpenIdConnectEvents
    {
        OnRedirectToIdentityProvider = async ctxt =>
        {
            logger.Info($"On Redirect To Identity Provider : {ctxt.Request.Host.Value}");
            await Task.Yield();
        },
        OnAuthenticationFailed = async ctxt =>
        {
            logger.Info($"On Authentication Failed");
            Console.WriteLine("On Authentication Failed");
            await Task.Yield();
        },
        OnSignedOutCallbackRedirect = async ctxt =>
        {
            logger.Info($"On Signed Out Callback Redirect");

            ctxt.HttpContext.Response.Redirect(ctxt.Options.SignedOutRedirectUri);
            ctxt.HandleResponse();
            await Task.Yield();
        },
        OnMessageReceived = async ctxt =>
        {
            logger.Info($"On Message Received : {ctxt.Request.Path.Value}");
        },
        OnAuthorizationCodeReceived = async context =>
        {
            logger.Info("Authorization Code Received");

            Console.WriteLine("Authorization Code Received");
        },
        OnTokenValidated = async context =>
        {
            logger.Info("Token Validated");

            Console.WriteLine("Token Validated");
        },
        OnRemoteFailure = async ctxt =>
        {
            logger.Info($"On Remote Failure : {ctxt.Failure?.Message}");
            ctxt.Response.Redirect("/");
            ctxt.HandleResponse();

            Console.WriteLine("On Remote Failure");

        },
        OnTokenResponseReceived = async ctxt =>
        {
            logger.Info($"On Access Denied");

            Console.WriteLine("OnTokenResponseReceived");
        },
        OnTicketReceived = async ctxt =>
        {
            logger.Info($"On Ticket Received : {ctxt.Request.Path.Value}");
         }
        );`

The log records OnRedirectToIdentityProvider event, but there is no logs on OnRemoteFailure or OnTokenResponseReceived.
Could you please advise me on how to resolve this error or log it for reference?

Thanks in advance. Any help appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant