Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > login a user using Api View modes: 
User avatar
Member
Member
eagleag - 5/9/2011 3:22:57 AM
   
login a user using Api
Hi,
I've added a field FACEBOOK_ID to CMS_User table.

I want to check for a users FACEBOOK_ID in CMS_User and ifExist to log that user into site (using his kentico user).

How can I login a user with API?
I ned his userName passwrd. How can I do this?

THANKS :)


User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 5/10/2011 2:54:23 AM
   
RE:login a user using Api
Hi,


you can authorize the user without the password like:

UserInfo ui = UserInfoProvider.GetUserInfo(userName);

// Set authentication cookie
FormsAuthentication.SetAuthCookie(ui.UserName, false);

// Set context values
CurrentUserInfo cui = new CurrentUserInfo(ui, true);
CMSContext.SetCurrentUser(cui);
CultureHelper.SetPreferredUICulture(cui.PreferredUICultureCode);

Best regards,
Helena Grulichova