Search code examples
authenticationasp.net-core-2.0asp.net-core-identityasp.net-core-2.2

asp.net core - stuck in authentication loop


if I configure authentication with

.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)

all works fine, but if I configure it

        .AddAuthentication(options => {
            options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
        })

Even after a succesful login, the user gets redirected to the logon page. I would expect the same behavior for both configs. Any thoughts ?


Solution

  • The problem was that I mixed using identity framework and custom claims/cookies. When I kicked out the use of the identityframework. It all worked as expected.

    See more in this case.