title: How should I implement OAuth for an application?
body: <p>I am creating an application for a client that needs to do the following:</p>
  
  <ul>
  <li>Allow users to authenticate using Google, Facebook, Twitter, and LinkedIn.</li>
  <li>Allow users to add additional providers after signing up. (i.e. if the user authenticated with Google then they should be able to add any or all of the other providers as well.)</li>
  <li>Allow users to import Google contacts, Facebook friends list, twitter followers, and Linkedin friends in order to build a custom contact list.</li>
  </ul>
  
  <p>Where is the best place to start learning about this? Is there a standard that everybody uses for these things in .NET? I've been Googling around for a few hours and while it seems most people point to <a href="http://www.dotnetopenauth.net/" rel="nofollow">DotNetOpenAuth</a> I can't seem to find any solid tutorials on how to use the library. The download comes with samples but it's still confusing me.</p>
  
  <p>I assumed it would be as simple as:</p>
  
  <ul>
  <li>Configure providers' secrets.</li>
  <li>Begin login with provider</li>
  <li>Authenticate user with auth cookie</li>
  <li>Create user record in my database and store unique ID from provider.</li>
  </ul>
  
  <p>But it seems like every provider has it's own set of code and it's all so different and confusing. Facebook has some graph object, twitter has some "InMemoryTokenManager" that I don't understand, and Google doesn't even have an authentication example, only a Google Address Book example. And on top of all that you have to copy bits of code out of some ApplicationBlock demo in the samples into your own app for some reason, and getting that all to compile without knowing what the heck it's trying to do is an arduous task.</p>
  
  <p>I feel like I'm missing something fundamental with all this.</p>
  
  <p>Even a book recommendation would be great at this point.</p>
  
  <p>I believe I understand the high-level concepts of OAuth but once I try to dive into the nitty-gritty I immediately get lost.</p>