fullstackhero / dotnet-starter-kit

Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
https://fullstackhero.net/dotnet-webapi-boilerplate/
MIT License
5.06k stars 1.52k forks source link

Is there any way to login without passing tenant id #1027

Closed shailybaba closed 1 week ago

shailybaba commented 1 week ago

Why we need to enter tenant when login while our user email-id is unique? Any how we can fetch tenant id using user email and then continue our password checking flow?

kallievz commented 1 week ago

It is unique per tenant if i am not mistaken.Same user can be linked to multiple tenants.

Get Outlook for iOShttps://aka.ms/o0ukef


From: shailybaba @.> Sent: Monday, September 9, 2024 8:32:02 AM To: fullstackhero/dotnet-starter-kit @.> Cc: Subscribed @.***> Subject: [fullstackhero/dotnet-starter-kit] Is there any way to login without passing tenant id (Issue #1027)

Why we need to enter tenant when login while our user email-id is unique? Any how we can fetch tenant id using user email and then continue our password checking flow?

— Reply to this email directly, view it on GitHubhttps://github.com/fullstackhero/dotnet-starter-kit/issues/1027, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXYXSF5NCHJ7EGZ2ET7JFILZVU6GFAVCNFSM6AAAAABN32EAKCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUYTGMBTGQZDGMY. You are receiving this because you are subscribed to this thread.Message ID: @.***>

iammukeshm commented 1 week ago

@shailybaba Email IDs can be used for multiple tenants. Hence recognizing tenant from email id will be not be a valid solution. In production cases, we wouldn't use this strategy where the user would have to type in the tenant. Rather, I would separate each tenant by SubDomains.

Root Tenant users can access the app via root.myawesomeapp.com Alpha Tenant users can access the app via alpha.myawesomeapp.com

In such cases you would have to use the Host Strategy of Finbuckle so that the API can recognize the tenant using the incoming Request URL, and decodes the tenant id from the subdomain. This will be the recommended flow.