Last active
August 29, 2015 14:01
-
-
Save james-dibble/7c4424f29b6c34ae0c51 to your computer and use it in GitHub Desktop.
Setting up WebSecutiry providers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace OAuthDemo.App_Start | |
{ | |
using System.Configuration; | |
using Microsoft.Web.WebPages.OAuth; | |
using WebMatrix.WebData; | |
public static class SecurityConfig | |
{ | |
public static void Setup() | |
{ | |
// Replace with real table and column names. Last paramater is true to create the WebSecurity tables if needed. | |
WebSecurity.InitializeDatabaseConnection("ConnectionStringName", "UsersTableName", "UsersTableNamePrimaryKey", "UsersTableNameEmailColumn", true); | |
OAuthWebSecurity.RegisterGoogleClient( | |
"Google"); | |
OAuthWebSecurity.RegisterTwitterClient( | |
ConfigurationManager.AppSettings["TwitterConsumerKey"], | |
ConfigurationManager.AppSettings["TwitterConsumerSecret"], | |
"Twitter"); | |
OAuthWebSecurity.RegisterFacebookClient( | |
ConfigurationManager.AppSettings["FacebookAppId"], | |
ConfigurationManager.AppSettings["FacebookAppSecret"], | |
"Facebook"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment