Reputation: 68972
I am building a WebApi2 project and wanted to use mongodb as a backend and I found MongoDB.AspNet.Identity package, I used it before in MVC5 website and it worked well, but after installing in the WebApi project I got an error:
Error 1 The type or namespace name 'IdentityUserLogin' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs
How to fix that? or it is impossible to use MongoDB.AspNet.Identity package with WebApi2 projects?
Upvotes: 3
Views: 2247
Reputation: 21
You mean replace,
user.Logins.Add(new IdentityUserLogin
{
LoginProvider = externalLogin.LoginProvider,
ProviderKey = externalLogin.ProviderKey
});
to
user.Logins.Add(new UserLoginInfo(
externalLogin.LoginProvider,
externalLogin.ProviderKey
));
Upvotes: 2
Reputation: 126
Change every occurence of IdentityUserLogin
to UserLoginInfo
. Furthermore change
user.Logins.Add(new UserLoginInfo
{
LoginProvider = externalLogin.LoginProvider,
ProviderKey = externalLogin.ProviderKey
});
to
user.Logins.Add(new UserLoginInfo(
externalLogin.LoginProvider,
externalLogin.ProviderKey
));
Should work now.
Upvotes: 7