This is an OAuth2 client to use with the DotNetOpenAuth project. The following code is an adaptation of Matt Johnson's DotNetOpenAuth.GoogleOAuth2 project
-
Setup your LinkedIn App using the LinkedIn Developer Network.
-
Compile from source and reference. (NuGet coming soon)
-
Register the client instead of the existing LinkedIn OpenId client.
var client = new LinkedInOAuth2Client("yourClientId", "yourClientSecret"); OAuthWebSecurity.RegisterClient(client);
Just like any other OAuthWebSecurity client, except you need one extra hook:
// add this line
LinkedInOAuth2Client.RewriteRequest();
// it belongs right before your existing call to
OAuthWebSecurity.VerifyAuthentication(....)
This is needed because LinkedIn requires that any extra querystring parameters for the
redirect be packed into a single parameter called state. Since OAuthWebSecurity needs
two parameters, __provider__ and __sid__ - we have to rewrite the url.
I don't work for Google, Microsoft, or DNOA. This is released under the MIT licence. Do what you want with it.