locked
Unable to login with users created through webapi in mvc5 RRS feed

  • Question

  • User1888916955 posted

    I have 2 projects, one an webapi project where in i create new users and i also have a standard mvc5 app, both using the same database.

    I had added profile information of the user in webapi using the method defined in SO post I am able to create the users. But when i try to login into the normal mvc5 app with the credentials of users created by webapi. i get a invalid username and password.

    i can login only with users which i have created from the standard mvc5 app. I had created the webapi with the code first approach and used the database first approach when creating the normal mvc app. Would there be a difference in the hash for password while creating and authenticating from webapi and normal mvc app? How can we get the users to work both from webapi and standard mvc5.

    I can see that there is a difference in the discriminator field when created from webapi (customuser) and from the normal mvc as (ApplicationUser)

    Thursday, August 21, 2014 9:35 PM

Answers

  • User-734925760 posted

    Hi,

    According to your description, I think you shuld make sure the encryption function is same between WebAPI and MVC application. Then I think you should make some break points to debug steps by steps. We can check if the useraccount and password which is not correct.

    THe same time you need to check that as youi create a project, if you have select  the Individual User Account by clicking Change Authentication. For more information, please refer to the link below:

    http://www.asp.net/web-api/overview/security/individual-accounts-in-web-api

    Hope it's useful for you.

    Best Regards,

    Michelle Ge

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 25, 2014 4:53 AM