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

Issues with latest MVC 5 web api #31

Open
Mech0z opened this issue Nov 22, 2015 · 1 comment
Open

Issues with latest MVC 5 web api #31

Mech0z opened this issue Nov 22, 2015 · 1 comment

Comments

@Mech0z
Copy link

Mech0z commented Nov 22, 2015

I have created a Web api project and tried to use this but get several issues

When I insert
this.UserManager = new UserManager(new UserStore("Mongo"));

In the default constructor I get

Severity Code Description Project File Line
Error CS0266 Cannot implicitly convert type 'Microsoft.AspNet.Identity.UserManager<WebApplication2.Models.ApplicationUser>' to 'WebApplication2.ApplicationUserManager'. An explicit conversion exists (are you missing a cast?) WebApplication2 C:\Git\Foosball9000\WebApplication2\Controllers\AccountController.cs 30

In IdentityConfig and Startup.Auth.cs there is a reference to ApplicationDbContext which I deleted, what should that be replaced with?

RegisterExternal in Accountcontroller have
var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };

But email is not defined in ApplicationUser, should that just be replaced with Id?

Hope this project is not dead :)

@jdelgado2002
Copy link

@Mech0z I just recently started using the code, so no expert here.

What I did, instead of instantiating "UserManager" I instantiated "ApplicationUserManager.
So my manager lines looks as follows:

var manager = new ApplicationUserManager(new UserStore("Mongo"));

By the way, the user store on this project does not implement IUserEmailStore, IUserPhoneNumberStore, IUserTwoFactorStore, and IUserLockoutStore. So if you are using any of the templates that come with single user authentication, you will get errors. Just implement them on your own.

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

No branches or pull requests

2 participants