MVC password format: hash, user verification without entering username / password

I am developing an MVC C # module that has a user password format set to Hash. Now I also have a Facebook login module besides the usual login. This Facebook login will merge with the regular login if the username matches.

My problem here is when I combined the Facebook login and this account will use the same password. I can get a user that returns a username and password and use Memberhip.ValidateUser to verify. But because of the hashed password, I can’t verify it for Facebook login. Do I need to decrypt it first or any other ideas?

+3
source share
1 answer

You don’t need to worry about the password at all. You can simply get the user associated with the facebook account and then authenticate this user manually

var userName= YourRepository.GetUsernameByFacebookId(returnedFacebookId);
FormsAuthentication.SetAuthCookie(userName);
+1
source

All Articles