Skip to content

Instantly share code, notes, and snippets.

@burck1
Last active August 29, 2015 14:02
Show Gist options
  • Save burck1/5277db564da5847b08e5 to your computer and use it in GitHub Desktop.
Save burck1/5277db564da5847b08e5 to your computer and use it in GitHub Desktop.
using Microsoft.AspNet.Identity;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.Google;
using Microsoft.Owin.Security.Facebook;
using Owin;
namespace ContactManager
{
public partial class Startup
{
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
app.UseFacebookAuthentication(new FacebookAuthenticationOptions
{
AppId = "000000000000000",
AppSecret = "00000000000000000000000000000000"
});
var googleOAuth2AuthenticationOptions = new GoogleOAuth2AuthenticationOptions
{
ClientId = "0000000000000-00000000000000000000000000000000.apps.googleusercontent.com",
ClientSecret = "0000000000000000000000",
};
googleOAuth2AuthenticationOptions.Scope.Add("openid");
app.UseGoogleAuthentication(googleOAuth2AuthenticationOptions);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment