Linked-In OAuth Library

I uploaded a package in Nuget Gallery that simplifies the interaction with linked-in. Uses a modified version of Hammock (because latest version has a bug) so be careful if you want to add it to your project. When the bug is fixed the correct dependency will be added to the package.

This package is in early development stage so a lot are subject to change. This post will be updated accordingly.

Version 0.0.1

Code that begins the Authorization process:

var session = LinkedInSession.RetrieveFromUserSession();
if (session == null)
{
    var token = OAuthManager.Current.CreateToken(callback: "http://localhost:1134/Account/LogOn");
    //The user is being redirected
    OAuthManager.Current.BeginAuth(token, endResponse: true, displayAllowDenyScreen: false);
}

Code that completes the Authorization process and retrieves user profile:

var token = OAuthManager.Current.GetTokenInCallback();
var session = OAuthManager.Current.CompleteAuth(token);
if (session.IsAuthorized())
{
    session.StoreInUserSession();
    var p = session.GetProfile();    
}

That’s all for now. There are a lot TODOs and many improvements to be done so stay tuned!

5 Comments

  • 




Cecil

    Whats the bug in Hammock? Did you file an issue in github ?

  • 




<a href="http://about.me/korayem" rel="nofollow">Korayem</a>

    The NuGet link is broken, it should be:
    $1http://nuget.org/List/Packages/LinkedIn.OAuth
    $1
    $1Cool wrapper
    $1
    $1Any plans? will you release it on GitHub?

  • 




Mike

    Why blog when you don't anser questions?
    $1
    $1What is the bug in Hammock? Is it fixed or not?

  • 




Mike

    Why blog when you don't answer questions?
    $1
    $1What is the bug in Hammock? Is it fixed or not?

  • Pedro Luz on said

    Reply
    




Pedro Luz

    I'm having a problem with this lib using State Server:
    $1
    $1"Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode."
    $1
    $1[SerializationException: Type 'LinkedIn.OAuth.LinkedInSession' in Assembly 'LinkedIn.OAuth, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.]

Add a Comment (gravatar-enabled)