MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

twitter connector  (Mono Support )

Viewed 21700 time(s), 3 post(s) 3/25/2011 7:41:32 AMby geneboss

Related topics

geneboss

geneboss

3/25/2011 7:41:32 AM
Hi there,
I want to create my own twitter and facebook connector instead of the current "janrain".
Can this be done?

Thank you in advance
Geneboss
This content has not been rated yet. 
189 Reputation 19 Total posts
khorvat

khorvat

3/25/2011 9:18:34 AM
Hi Geneboss,

"janrain" like Twitter connector can be implemented to get you started here are some links:

Twitter C# Library - http://code.google.com/p/twitterizer/ (New site: http://www.twitterizer.net/)
Integrating Twitter Into An ASP.NET Website - http://www.4guysfromrolla.com/articles/021710-1.aspx


After you perform all necessary steps with Twitter connector and get all the data from Twitter you need to follow these steps to enable the user MonoX usage:

 1. Create or Update a user in MonoX system 
 2. Put user in default roles
 3. Login the user 

Here is a sample code to do some of the above tasks

authenticatedUser = Membership.GetUser(providerUserKey);
if (authenticatedUser == null)
{
  string userNameToUse = SecurityUtility.FindAvailableUserName(preferredName);
  MembershipCreateStatus membershipCreateStatus;
  MembershipUser authenticatedUser = Membership.CreateUser(userNameToUse, SecurityUtility.GenerateRandomPassword(), eMail, "PasswordQuestion", preferredName, true, providerUserKey, out membershipCreateStatus);
  //add user to default user role id it exists
  try
  {
    foreach (string role in MonoXUtility.SplitConfigurationString(ApplicationSettings.DefaultUserRoles))
    Roles.AddUserToRole(userNameToUse, role);
  }
  catch { }
}
else
{
  //update e-mail address if it has changed
  if (!string.IsNullOrEmpty(eMail) && authenticatedUser.Email != eMail)
  {
    authenticatedUser.Email = eMail;
    Membership.UpdateUser(authenticatedUser);
  }
}
 
// Use FormsAuthentication to tell ASP.NET that the user is now logged in, 
// with the OpenID Claimed Identifier as their username.
FormsAuthentication.RedirectFromLoginPage(authenticatedUser.UserName, false);

I hope this will get you started if you have any additional questions feel free to post them here

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
geneboss

geneboss

3/25/2011 4:00:10 PM
Thank you for the quick response Khorvat.

Regards
Geneboss
This content has not been rated yet. 
189 Reputation 19 Total posts