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

I am using Per-Tenant Data with identity but the AddLoginAsync from Identity library won't work #926

Open
paburgos opened this issue Jan 7, 2025 · 2 comments
Labels

Comments

@paburgos
Copy link

paburgos commented Jan 7, 2025

Hello,

I am wondering if you can suggest a fix for this issue:

I am using Per-Tenant Data with identity, And as the documentation describes I can see the TenantID added as a primary key to the AspNetUserLogins table. However, when I try to add a login:

result = await UserManager.AddLoginAsync(user, externalLoginInfo);

I get this exception:

'System.InvalidOperationException': Unable to track an entity of type 'IdentityUserLogin<string>' because its primary key property 'TenantId' is null.

@kin3tik
Copy link

kin3tik commented Jan 16, 2025

I'm running into the same issue. @AndrewTriesToCode do you have any advice? 🙏

@AndrewTriesToCode
Copy link
Contributor

AndrewTriesToCode commented Jan 22, 2025

Hi, that particular entity is a little different from the others and I'm not sure why.

First thing I recommend to try is to set the TenantNotSetMode for your context to Override to basically force it.

I will look into this further -- let me know if that setting helps.

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

3 participants