Skip to content

Refused to connect. /sign-oidc  #76

Open

Description

@ravisankarnbr

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions