title: How can I get started using OpenID/OAuth with my WebMatrix site?
body: <p>If I misuse or confuse the terms OpenID and OAuth, I apologize, I am still new to this whole decentralized login process.</p>
  
  <p>I have been trying for days now to get my site (built in WebMatrix) to recognize a Google login. The problem is I need this line of code (from what I've researched) in my <code>_AppStart.cshtml</code> file:</p>
  
  <pre><code>OAuthWebSecurity.RegisterGoogleClient();
  </code></pre>
  
  <p>But when I try to run this site after this statement is in place, I simply get a server error stating that <code>OAuthWebSecurity.RegisterGoogleClient();</code> does not exist in the current context.</p>
  
  <p>I thought I might need the OAuth library, a different helper, or some other package, but the only relevant package I see (<em>Microsoft WebPages OAuth library 2.0.20710.0</em>) I can't get, because WebMatrix doesn't support the version of NuGet it says that I need (2.0).</p>
  
  <p>I have never used this method for a log in before and I want to learn how as I build this functionality for my clients.  What I <strong>do not</strong> want to do is open up the starter template, and copy my files over. I have a problem using code that I don't understand. I feel that this would be a terrible habit for me to get into (it took some convincing myself before I would even use jQuery plug-ins).  It also might bear mentioning that I will not be using any other third party service for this login. We use gmail for our employees' company email accounts so I need <strong>only Google</strong> logins for this solution.</p>
  
  <p>Things I have tried:</p>
  
  <ul>
  <li>Googling for other scenarios like mine. <strong>Fails because no relevant search results are found (i.e., I am unable to find results that match my scenario)</strong></li>
  <li>Searching for earlier versions of the <em>Microsoft WebPages OAuth library 2.0.20710.0</em> package. <strong>Fails because my search returns no such packages.</strong></li>
  <li>Using <code>OAuthWebSecurity.RegisterOpenIDClient(BuiltInOpenIDClient.Google);</code> instead of <code>OAuthWebSecurity.RegisterGoogleClient();</code> <strong>Fails for the same reason as when using <code>OAuthWebSecurity.RegisterGoogleClient();</code></strong></li>
  <li>Visiting Site Administration and downloading the OAuth Library.
  <strong>Fails because NuGet needs an update</strong></li>
  <li>Update Nuget <strong>Fails because of what is mentioned here (apparently, a known bug for WebMatrix):</strong> <a href="http://forums.asp.net/t/1836913.aspx/1?Error+updating+DotNetOpenAuth+updates+with+NuGet+Gallery" rel="nofollow">http://forums.asp.net/t/1836913.aspx/1?Error+updating+DotNetOpenAuth+updates+with+NuGet+Gallery</a></li>
  <li>Opening up the Starter Site Template, which already has OAuth built in and functional.<strong>Fails to teach me as to why this site recognizes <code>OAuthWebSecurity.RegisterGoogleClient()</code> and mine doesn't, because there is no clear way (that I am aware of) to tell what pacakages, updates, and/or versions of third party software might be different.</strong></li>
  <li>Creating a new Starter Site and copying any OAuth based missing files from the *"App_Data"* and <em>"bin"</em> folders. <strong>Fails in that no behavioral changes were observed.</strong></li>
  </ul>
  
  <p>-----------------------------------------<strong>UPDATE</strong>----------------------------------------</p>
  
  <p>So far, to date, the best solution for this problem, at least for me, has been to just use the "Starter Site" template in WebMatrix, whether I like it or not.</p>
  
  <p>One of my biggest worries for doing this, however, was that there were so many extraneous files that I wasn't sure what I could and couldn't delete to keep the site clean while still leaving the <code>OAuthWebSecurity()</code> class fully accessible and functional. I have, however kept only the "bin" and "App_Data" folders (including all of their contents, of course) from the "Starter Site" template and deleted everything else (including the web.config file) before moving my files over, and this has appeared to work very well for me, so far.</p>
  
  <p>Using the above mentioned steps, I have kept my site clean of unnecessary code, while still having access to the <code>OAuthWebSecurity()</code> class.</p>
  
  <p>In the future (I imagine when WebMatrix 3 is released) this bug will probably be fixed and a simple admin site install of the OAuth library will not require a version of NuGet that WebMatrix does not support, but until then, this has been the best answer for me.</p>