Base solution for your next web application

Activities of "kansoftware"

hi

You need to overwrite it when it is to be used.

You can output more logs in the Logout method for troubleshooting.

Thanks.

Ok and the same thing zero does on login with the base code for openid options?

https://github.com/maliming/CDP-Base-Zero-13.0.0/blob/master/src/CDP.Web.Mvc/Controllers/AccountController.cs#L301-L357

Ok I will try that but I believe it should not override the provider options when login in with 2 different tenants. Does the base code of dot net also does the same or it set the options tenant wise?

hi

Please share your code. I need to make sure the code is the same.

Thanks.

Shared you over the email.

hi

I checked, There is no problem with https://github.com/maliming/CDP-Base-Zero-13.0.0/

Can you share the full code of your AccountController?

liming.ma@volosoft.com

Thanks.

Did you tried with 2 different tenants and auth0 keys? The issue is its overriding the options.

hi

I will check the https://github.com/maliming/CDP-Base-Zero-13.0.0/ project with the tenant again

Thanks.,

Hi, were you able to find a solution for the issue?

hi

Can you reproduce the above case and share the Logs.txt file?

liming.ma@volosoft.com

Thanks.

I don't think logs file will help you out, as I can't see any such error or logs related to this in logs file. what exactly you want to check? Also I believe when we are setting the options in custom class MyOpenIdChallengeResult we are not setting it tenant and it is getting override with the latest login tenant options.

hi

I login with a tenant with auth0 provider and in the same browser I login with different tenant with auth0 provider but with different set of keys. Then I logout the first tenant it redirected to the wrong auth0 domain but the redirect URL in the URL is correct.

What is your app domain?

Is it localhost?

No it's not localhost, it's my application domain. It's https://[subdomain].fynuat.com

Look below is the url its redirecting to on logout button https://migrationlegacy.us.auth0.com/oidc/logout?post_logout_redirect_uri=https%3A%2F%2Fyk200.fynuat.com%2Fsignout-callback-oidc&client_id=9naPa8jYHsj521uML82TJXXT3lJSyuDq&state=CfDJ8H6zcQn6iRNFqr3e5L-a1vPB0ZxM1C3988shPs3QZT6ikuMFZWcEY4MuARwvZzBxz4rANpHBdXyRytoXecECDEXDzRQP4qebAFFoWMwo1-fN1VZ984QaPbHST84og2NeWuZQM4a9UZzBH0UP03EKnJKDDYgoltJNtZd_X05KSCvjzK0IeLjJX1tN54HuOPmGsw&x-client-SKU=ID_NET8_0&x-client-ver=7.1.2.0

Where my auth0 domain should be https://yk200.us.auth0.com. Also my client_id is wrong, it's of other tenant I am logged in into.

One issue I am facing randomly using the custom code is, I login with a tenant with auth0 provider and in the same browser I login with different tenant with auth0 provider but with different set of keys. Then I logout the first tenant it redirected to the wrong auth0 domain but the redirect URL in the URL is correct.

And sometimes on logout, it is actually not making me logout from auth0. Below is my logout code. Also randomly we are facing issue on login when its redirecting to https://yk200.fynuat.com/signin-oidc. The error I am receiving in the logs for this is ERROR 2025-04-02 06:32:40,891 [64 ] ation.OpenIdConnect.OpenIdConnectHandler - Message contains error: 'invalid_grant', error_description: 'Invalid authorization code', error_uri: 'error_uri is null', status code '403'.

public async Task<ActionResult> Logout(string returnUrl = "")
{
    var scheme = "";

    var external = await HttpContext.AuthenticateAsync(IdentityConstants.ExternalScheme);
    if (!external.Succeeded)
    {
        return await AfterLogout();
    }
    scheme = external.Properties.Items["zero_scheme"];
    if(scheme=="okta")
    {
        return await AfterLogout();
    }

    var authProperties = new AuthenticationProperties
    {
        RedirectUri = "/Account/AfterLogout?returnUrl=" + Uri.EscapeDataString(returnUrl)
    };

    return new SignOutResult(OpenIdConnectDefaults.AuthenticationScheme, authProperties);
    
}


public async Task<ActionResult> AfterLogout(string returnUrl = "")
{
    await _signInManager.SignOutAsync();
    var userIdentifier = AbpSession.ToUserIdentifier();

    if (userIdentifier != null &&
        _settingManager.GetSettingValue<bool>(AppSettings.UserManagement.AllowOneConcurrentLoginPerUser))
    {
        var user = await _userManager.GetUserAsync(userIdentifier);
        await _userManager.UpdateSecurityStampAsync(user);
    }

    if (!string.IsNullOrEmpty(returnUrl))
    {
        returnUrl = NormalizeReturnUrl(returnUrl);
        return Redirect(returnUrl);
    }

    return RedirectToAction("Login");
}

use a repository with a read structure

hi

FYI - our application is running on linux server over nginx

You can add a middleware code.

https://github.com/maliming/CDP-Base-Zero-13.0.0/commit/5152c06f8459c96cbd2b416f02fc910a22a80843

app.Use((ctx, next) => 
{ 
    ctx.Request.Scheme = "https"; 
    return next(); 
}); 

Ok. But when I am using the base code and add that https redirect code in auth configure it works, but not with the custom code in MyOpenIdChallengeResult.cs why is it so? Also right now internally on nginx our application runs on http will the fix shared by you will disturb this setting?

Showing 1 to 10 of 143 entries