If I abuse or confuse the terms OpenID and OAuth, sorry, I'm still new to this decentralized login process.
I tried for several days so that my site (embedded in WebMatrix) recognizes the Google login. The problem is that I need this line of code (from what I examined) in the _AppStart.cshtml file:
OAuthWebSecurity.RegisterGoogleClient();
But when I try to start this site after this statement, I just get a server error stating that OAuthWebSecurity.RegisterGoogleClient(); does not exist in the current context.
I thought that I might need the OAuth library, another helper or some other package, but the only relevant package that I see (Microsoft WebPages OAuth library 2.0.20710.0), I can not get because WebMatrix does not support the NuGet version says what I need (2.0).
I have never used this method to log in before, and I want to know how I create this function for my clients. What I don't want is to open the starter template and copy my files. I have a problem with code that I don't understand. I feel like this would be a terrible habit for me (it took me some conviction before I even used jQuery plugins). It may also mean that I will not use any other third-party service for this entry. We use gmail for the email accounts of our employees, so for this solution I only need Google .
Things I tried:
- Googling for other scripts like mine. It doesn’t work because no matching search results were found (i.e. I cannot find results matching my scenario)
- Search for earlier versions of the Microsoft OAuth 2.0.20710.0 Web Pages Package. Failure because my search does not return such packets.
- Using
OAuthWebSecurity.RegisterOpenIDClient(BuiltInOpenIDClient.Google); instead of OAuthWebSecurity.RegisterGoogleClient(); Failure for the same reason as when using OAuthWebSecurity.RegisterGoogleClient(); - Visit site administration and download OAuth library. Crashing because NuGet needs to be updated
- Refresh Nuget Failure due to what is mentioned here (apparently a known bug for WebMatrix): http://forums.asp.net/t/1836913.aspx/1?Error+updating+DotNetOpenAuth+updates+with+NuGet+ Gallery
- Opening the Starter Site template, which already has OAuth, is built-in and functional. I can’t teach me why this site recognizes
OAuthWebSecurity.RegisterGoogleClient() , but mine does not, because there is no clear path (what I know) to let me know which packs, updates and / or versions of third-party software may differ. - Create a new start site and copy any missing OAuth files from the * "App_Data" * and "bin" folders. The failure is that no behavioral changes were observed.
----------------------------------------- UPDATE -------- --------------------------------
So far, the best solution to this problem, at least for me, was to simply use the Start Site template in WebMatrix whether I like it or not.
One of my biggest worries for this, however, was that there were so many extraneous files that I wasn’t sure I could and couldn’t remove the site to be clean, leaving the OAuthWebSecurity() class fully accessible and functional . However, I saved only the bin and App_Data folders (including all their contents) from the Start Site template and deleted everything else (including the web.config file) before moving my files, and that turned out to be very good for me, until.
Using the above steps, I saved my site with redundant code, while remaining access to the OAuthWebSecurity() class.
In the future (I think when WebMatrix 3 will be released), this error will probably be fixed, and a simple installation of the OAuth admin site will not require a version of NuGet that WebMatrix does not support, but before that was the best answer for me.