I'm blond. I'm dumb. But I program.
So I want a damn simple way to authenticate with Facebook, Twitter or wherever.
I DON'T CARE IF IT'S OAUTH OR OPENID OR OH-GO-SCREW-YOURSELF.
I just want to do
- Send me off to Facebook, Twitter, wherever.
- Come back to my site and the site now has whatever user data they handed over.
That's It.
- No dabasase crap.
- No Session stuff.
- No over-generic-crazy one-solution-fits-every-provider-on-the-interwebs.
public RedirectResult FacebookAuthentication()
{
Session.Add("a", "a"); // Keep the SessionId constant.
return AuthenticationService.RedirectToFacebookAuthentication(Session.SessionID);
}
public ActionResult AuthenticateCallback()
{
var client = AuthenticationService.CheckCallback(Request, Session.SessionID);
var model = new AuthenticateCallbackViewModel();
if (client is FacebookClient)
{
var facebookClient = client as FacebookClient;
model.AccessToken = facebookClient.AccessToken;
model.Name =
(facebookClient.UserInformation.FirstName + " " + facebookClient.UserInformation.LastName).Trim();
model.UserName = facebookClient.UserInformation.UserName;
model.Message = "Authenticated with Facebook successfully.";
}
return View(model);
}
Don't be scared to fork and then make some pull requests. I ❤️ pull requests!
Then this simple library can actually be really helpful to more than 1 person (le moi) on rock called Earth.
No blonds or Unicorns were harmed in the coding of this library.