Hi,
I am unable to log into the tenant even by impersonation or by switching to the tenant in the login page, getting that the tenant user could not be found in case of impersonation login or getting the tenant cannot be found in case of trying to switch to the tenant in login page, attached a loom video and some screenshots regarding the issue here so you can understand the problem, please let us know if you find anything.
Thank you
13 Answer(s)
-
0
To resolve the issues with tenant impersonation and tenant switching (400/403 errors, "tenant does not exist", "no user with username: admin"), please check the following:
Tenant Existence and Name
- Ensure the tenant name ("alpha" in your screenshots) is correct and exists in the database.
- Tenant names are case-sensitive and must match exactly.
Tenant Admin User
- Each tenant must have an admin user. By default, the username is "admin" unless changed during tenant creation.
- If you get "There is no user with username: admin!", verify that the "admin" user exists under the "alpha" tenant. You can check this in the SaaS > Tenants > Users section.
Cache Consistency
- In tiered/separated deployments, cache key mismatches can cause tenant/user not found errors.
- Ensure all your services (AuthServer, HttpApi.Host, etc.) use the same cache configuration and prefix. If you recently upgraded or changed configuration, clear all distributed caches (e.g., Redis).
Database Consistency
- Confirm that the tenant and its admin user exist in the correct tables (SaasTenants, AbpTenants, AbpUsers) and are not soft-deleted.
Migration Issues
- If you recently upgraded ABP or migrated from community to commercial, follow the official migration guide and ensure all migrations are applied:
- https://docs.abp.io/en/abp/latest/Migration-Guides/Abp-8_1
- If you recently upgraded ABP or migrated from community to commercial, follow the official migration guide and ensure all migrations are applied:
Impersonation Permissions
- Make sure the host user has the required permissions for tenant/user impersonation:
- https://abp.io/docs/latest/modules/account/impersonation
- Make sure the host user has the required permissions for tenant/user impersonation:
Restart and Clear Cookies
- After making changes, restart all services and clear browser cookies to avoid stale session/cookie issues.
If you follow these steps and the issue persists, double-check the logs for cache or database inconsistencies, and ensure the tenant and user data are present and correct.
Sources:
- https://abp.io/docs/latest/modules/account/impersonation
- https://abp.io/support/questions/7020
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
[AI-Bot] said: To resolve the issues with tenant impersonation and tenant switching (400/403 errors, "tenant does not exist", "no user with username: admin"), please check the following:
Tenant Existence and Name
- Ensure the tenant name ("alpha" in your screenshots) is correct and exists in the database.
- Tenant names are case-sensitive and must match exactly.
Tenant Admin User
- Each tenant must have an admin user. By default, the username is "admin" unless changed during tenant creation.
- If you get "There is no user with username: admin!", verify that the "admin" user exists under the "alpha" tenant. You can check this in the SaaS > Tenants > Users section.
Cache Consistency
- In tiered/separated deployments, cache key mismatches can cause tenant/user not found errors.
- Ensure all your services (AuthServer, HttpApi.Host, etc.) use the same cache configuration and prefix. If you recently upgraded or changed configuration, clear all distributed caches (e.g., Redis).
Database Consistency
- Confirm that the tenant and its admin user exist in the correct tables (SaasTenants, AbpTenants, AbpUsers) and are not soft-deleted.
Migration Issues
- If you recently upgraded ABP or migrated from community to commercial, follow the official migration guide and ensure all migrations are applied:
- https://docs.abp.io/en/abp/latest/Migration-Guides/Abp-8_1
- If you recently upgraded ABP or migrated from community to commercial, follow the official migration guide and ensure all migrations are applied:
Impersonation Permissions
- Make sure the host user has the required permissions for tenant/user impersonation:
- https://abp.io/docs/latest/modules/account/impersonation
- Make sure the host user has the required permissions for tenant/user impersonation:
Restart and Clear Cookies
- After making changes, restart all services and clear browser cookies to avoid stale session/cookie issues.
If you follow these steps and the issue persists, double-check the logs for cache or database inconsistencies, and ensure the tenant and user data are present and correct.
Sources:
- https://abp.io/docs/latest/modules/account/impersonation
- https://abp.io/support/questions/7020
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Tried everything but could not solve the issue.
-
0
hi
Please try to inject
ITenantStore
andITenantRepository
and callGetListAsync
method to see tenants in your Index page..Also enable the debug log of EF Core to see the sql querys.
https://abp.io/support/questions/8622/How-to-enable-Debug-logs-for-troubleshoot-problems
-
0
[maliming] said: hi
Please try to inject
ITenantStore
andITenantRepository
and callGetListAsync
method to see tenants in your Index page..Also enable the debug log of EF Core to see the sql querys.
https://abp.io/support/questions/8622/How-to-enable-Debug-logs-for-troubleshoot-problems
This is the log I am getting while switching to the tenant and trying login into the tenant in the login page (enabled debug logs of EF Core)
the log says that the given tenant does not exist, but it is available in SaaSTenants table
-
0
hi
Please try to inject ITenantStore and ITenantRepository and call GetListAsync method to see tenants in your Index page..
Can you try that?
Thanks.
-
0
[maliming] said: hi
Please try to inject ITenantStore and ITenantRepository and call GetListAsync method to see tenants in your Index page..
Can you try that?
Thanks.
I have used ITenantStore and ITenantRepository and called GetListAsync method to see tenants in BookAppService where we are calling GetListAsync from the host level, below attached are screenshot of the implementation
-
0
hi
Can you share a project to reproduce this problem?
liming.ma@volosoft.com
I will download and debug it.
Thanks.
-
0
[maliming] said: hi
Can you share a project to reproduce this problem?
liming.ma@volosoft.com
I will download and debug it.
Thanks.
But I think you will be able to login into the tenant, I have this same project in two other systems and I can login into the tenant with no problems, this issue only arises in my computer which shares the same codebase and database as the other computers, what might be the problem here which I'm unable to point out.
-
0
hi
Can you try to clear your local Redis?
Your issue is related to your local environment, not the code.
-
0
[maliming] said: hi
Can you try to clear your local Redis?
Your issue is related to your local environment, not the code.
Hey maliming
I have tried clearing Redis cache multiple times using redis-cli flushall and flushdb, didn't work unfortunately :-(
-
0
hi
You can override the
MultiTenantConnectionStringResolver
to see if the connection string is correct.https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/MultiTenantConnectionStringResolver.cs#L27-L81
-
0
[maliming] said: hi
You can override the
MultiTenantConnectionStringResolver
to see if the connection string is correct.https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/MultiTenantConnectionStringResolver.cs#L27-L81
Hey
I found the issue, the connection string for the AuthServer was wrong and I just needed to change it to the correct one. The issue got solved.
Thank you ;-)
-
0
Great