Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the TenantInfo based on default user's default #869

Open
abhishekp21 opened this issue Aug 12, 2024 · 1 comment
Open

Set the TenantInfo based on default user's default #869

abhishekp21 opened this issue Aug 12, 2024 · 1 comment
Labels

Comments

@abhishekp21
Copy link

I am working on project based on https://github.com/fullstackhero/dotnet-starter-kit

I have a scenario where user belongs to multiple tenants but I want to collect only the username and password on the login screen, without requiring tenant at that stage. Instead, I want to retrieve the user's default tenant from the UserManager (user table) and generate the token. However, since Finbuckle is implemented, it expects tenant information during the authentication process, which is leading to issues with token generation. Could you help me resolve this?

image image
@AndrewTriesToCode
Copy link
Contributor

Hi, this is something I've done before and found it worked pretty well. I recommend using the regular IdentityDbContext with a many-to-many relationship between users and tenants rather than MultiTenantIdentityDbContext because then a single user cannot belong to multiple tenants as easily and also because you won't know the tenant yet when you need to use the db context.

Then I've stored the default tenant in a user claim or alternatively you could add it as a property on your custom user entity class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants