Open Closed

Login Error #379


User avatar
0
chanchai-mwp created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v3.0.5
  • UI type: MVC
  • Tiered (MVC) or Identity Server Seperated (Angular): yes
  • Exception message and stack trace: error message: OpenIdConnectProtocolException: Message contains error: 'invalid_grant', error_description: 'error_description is null', error_uri: 'error_uri is null'.
  • Steps to reproduce the issue: Login to website

Result:

Host (host db): success Tenant1 (host db): success Tenant2 (separate tenant db): fail

Could you please help?

Thanks, Chanchai

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Do you initialize seed data? try run the .DbMigrator project.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    chanchai-mwp created

    I do.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    I will check it out.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    This is a problem.

    Try to add the following code to the .identityserver project:

    public class FormTenantResolveContributor: HttpTenantResolveContributorBase
    {
        public const string ContributorName = "Form";
    
        public override string Name => "Form";
    
        protected override string GetTenantIdOrNameFromHttpContextOrNull(
            ITenantResolveContext context,
            HttpContext httpContext) => httpContext.Request?.Form[context.GetAbpAspNetCoreMultiTenancyOptions().TenantKey];
    }
    
    Configure<AbpTenantResolveOptions>(options =>
    {
        options.TenantResolvers.Add(new FormTenantResolveContributor());
    });
    

    Try to add the following code to the .Web project:

    .AddOpenIdConnect("oidc", options =>
    {
        //.......
        
        options.Events = new OpenIdConnectEvents()
        {
            OnAuthorizationCodeReceived = receivedContext =>
            {
                if (receivedContext.Request.Cookies.ContainsKey("__tenant"))
                {
                    receivedContext.TokenEndpointRequest.SetParameter("__tenant",
                        receivedContext.Request.Cookies["__tenant"]);
                }
    
                return Task.CompletedTask;
                ;
            }
        };
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.