Hi,
I am currently working on an ASP.NET Zero-based solution that includes a primary project named Web.Host. This project is successfully utilizing JWT-based authentication along with social login providers (e.g., Facebook, Google) configured through ABP modules.
I am attempting to add an additional API project named Web.Reports to the solution. The goal is to have Web.Reports use the same authentication mechanism as Web.Host, enabling the frontend to authenticate once and access endpoints from both Web.Host and Web.Reports seamlessly.
Best regards!
4 Answer(s)
-
0
Hi @[email protected],
I will review the code a bit more to provide the best solution.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi
@[email protected],Based on your setup, it's possible to reuse the same authentication mechanism across both
Web.HostandWeb.Reportswithout much customization. Since theTokenAuthControlleris already in theWeb.Coreproject, both APIs can leverage the same logic seamlessly.To achieve this, I recommend the following steps:
- Move the
AuthConfigurerclass fromWeb.HosttoWeb.Core. This will allow bothWeb.HostandWeb.Reportsto share the same authentication configuration without duplicating code. - In the
Startup.csof yourWeb.Reportsproject, ensure that the authentication settings mirror those ofWeb.Host. Specifically, copy over the configurations related to JWT authentication, authorization policies, and any other relevant middleware.
Once this setup is complete, the same token should work seamlessly across both APIs, allowing your frontend to authenticate once and access endpoints from both projects without issues.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) - Move the
-
0
Hi @m.aliozkaya,
Thank you for your recommendations. I followed the steps to move
AuthConfigurertoWeb.Coreand mirrored the authentication setup inWeb.Reports. However, I am still facing the following issues:Token Validation Failure:
Tokens generated inWeb.Hostare not recognized inWeb.Reports, resulting in401 Unauthorized. TheSecurityKey,Issuer, andAudiencesettings are identical in both projects, and authentication middleware is configured.WebReportsModule Dependency Issue:
When initializing theWebReportsModule, I encounter the following error:Castle.MicroKernel.Handlers.HandlerException: Can't create component 'SignalRChatCommunicator' as it has dependencies to be satisfied.I do not require
SignalRChatCommunicatorinWeb.Reportsand need guidance on excluding it from the module while retaining ABP features like[AbpAuthorize], feature management, and multi-tenancy.Leveraging Multi-Tenancy and ABP Features:
What is the recommended approach to enable multi-tenancy and other ABP features like feature management in theWeb.Reportsproject while keeping it independent ofWeb.Host? Are there specific configurations or dependencies required to share these capabilities across projects?
Could you provide guidance on synchronizing token validation across APIs and properly configuring
WebReportsModuleto enable ABP features without unnecessary dependencies?Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi benjamin,
Is it possible for you to share your project with us via email ([email protected]) ? We can check these problems for you.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)