View on GitHub

GitHub OAuth2 Client

A GitHub OAuth 2 Client for ASP.NET MVC 4 via DotNetOpenAuth

Download this project as a .zip file Download this project as a tar.gz file

GitHubOAuth2Client

A GitHub OAuth 2 Client for ASP.NET MVC 4 via DotNetOpenAuth.

Add this to your project and add 1 line of code and it will hook directly into the Membership Provider in ASP.NET MVC 4!

Auto-magical-fantastical Installation

Start with a default ASP.NET MVC 4 internet site project.

Install this package via Nuget!

After the package install finishes just fill in the "GitHub.ClientId" and "GitHub.ClientSecret" App Settings in the web.config.

The GitHub login service option should automatically appear on your /account/login page.

Manual Installation

I don't know why you would need this, but if you want to manually add the project, you are welcome to do so. Currently there is no package for "just the dll". Here is what you would need to do:

  1. Pull down the project, compile it, and add a reference to it.
  2. Add your GitHub Client ID and Client Secret to your web.config
    1. <add key="GitHub.ClientId" value= "YourClientId" />
    2. <add key="GitHub.ClientSecret" value= "YourClientSecret" />
  3. Add the following line to your AuthConfig.cs:

    OAuthWebSecurity.RegisterClient(new JohnnyCode.GitHubOAuth2Client(ConfigurationManager.AppSettings["GitHub.ClientId"], ConfigurationManager.AppSettings["GitHub.ClientSecret"]), "GitHub", null);
    

Technically this route might be cleaner since you don't have a separate file for the package config. But until I create a core Nuget package for this library, I would stick with the existing Nuget package.