本文整理汇总了C#中IAppBuilder.UseFacebookAuthentication方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.UseFacebookAuthentication方法的具体用法?C# IAppBuilder.UseFacebookAuthentication怎么用?C# IAppBuilder.UseFacebookAuthentication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAppBuilder
的用法示例。
在下文中一共展示了IAppBuilder.UseFacebookAuthentication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfigureAuth
// 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);
// Uncomment the following lines to enable logging in with third party login providers
app.UseMicrosoftAccountAuthentication(
clientId: "000000004C10DD37",
clientSecret: "RYELs9crdp8Eebca5YeO0cQQBzbsyGN8");
app.UseTwitterAuthentication(
consumerKey: "LHpUEuCYelGiT1zYJrHTDw",
consumerSecret: "VZnwWxOfzFv9K9FOrfirz2fhD47wgSMo5m41zV3Has");
app.UseFacebookAuthentication(
appId: "207117879494713",
appSecret: "a9496a24c4a27bb5b3ecbb9805306afc");
app.UseGoogleAuthentication();
}
示例2: ConfigureAdditionalIdentityProviders
public static void ConfigureAdditionalIdentityProviders(IAppBuilder app, string signInAsType)
{
var google = new GoogleOAuth2AuthenticationOptions
{
AuthenticationType = "Google",
SignInAsAuthenticationType = signInAsType,
ClientId = "client", //"767400843187-8boio83mb57ruogr9af9ut09fkg56b27.apps.googleusercontent.com",
ClientSecret = "secret" //"5fWcBT0udKY7_b6E3gEiJlze"
};
app.UseGoogleAuthentication(google);
var fb = new FacebookAuthenticationOptions
{
AuthenticationType = "Facebook",
SignInAsAuthenticationType = signInAsType,
AppId = "app", //"676607329068058",
AppSecret = "secret" //"9d6ab75f921942e61fb43a9b1fc25c63"
};
app.UseFacebookAuthentication(fb);
var twitter = new TwitterAuthenticationOptions
{
AuthenticationType = "Twitter",
SignInAsAuthenticationType = signInAsType,
ConsumerKey = "consumer", //"N8r8w7PIepwtZZwtH066kMlmq",
ConsumerSecret = "secret" //"df15L2x6kNI50E4PYcHS0ImBQlcGIt6huET8gQN41VFpUCwNjM"
};
app.UseTwitterAuthentication(twitter);
}
示例3: ConfigureSocialIdentityProviders
public static void ConfigureSocialIdentityProviders(IAppBuilder app, string signInAsType)
{
var google = new GoogleAuthenticationOptions
{
AuthenticationType = "Google",
SignInAsAuthenticationType = signInAsType
};
app.UseGoogleAuthentication(google);
var fb = new FacebookAuthenticationOptions
{
AuthenticationType = "Facebook",
SignInAsAuthenticationType = signInAsType,
AppId = "676607329068058",
AppSecret = "9d6ab75f921942e61fb43a9b1fc25c63"
};
app.UseFacebookAuthentication(fb);
var twitter = new TwitterAuthenticationOptions
{
AuthenticationType = "Twitter",
SignInAsAuthenticationType = signInAsType,
ConsumerKey = "N8r8w7PIepwtZZwtH066kMlmq",
ConsumerSecret = "df15L2x6kNI50E4PYcHS0ImBQlcGIt6huET8gQN41VFpUCwNjM"
};
app.UseTwitterAuthentication(twitter);
}
示例4: ConfigureOAuth
private void ConfigureOAuth(IAppBuilder app)
{
app.UseExternalSignInCookie(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ExternalCookie);
OAuthBearerOptions = new OAuthBearerAuthenticationOptions();
OAuthAuthorizationServerOptions oAuthServerOptions = new OAuthAuthorizationServerOptions()
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
Provider = new SimpleAuthorizationServerProvider(new AccountRepository())
};
GoogleAuthOptions = new GoogleOAuth2AuthenticationOptions()
{
ClientId = "592613624399-a3gr6vveaocnptgvv6738rmnk0pb5cev.apps.googleusercontent.com",
ClientSecret = "FqNKKib_BP7dsNYBoJa8NwUC",
Provider = new GoogleAuthProvider()
};
app.UseGoogleAuthentication(GoogleAuthOptions);
FacebookAuthOptions = new FacebookAuthenticationOptions()
{
AppId = "806191272841558",
AppSecret = "1a8241e9d46c4a5e393ae51f265a3489",
Provider = new FacebookAuthProvider()
};
app.UseFacebookAuthentication(FacebookAuthOptions);
// Token Generation
app.UseOAuthAuthorizationServer(oAuthServerOptions);
app.UseOAuthBearerAuthentication(OAuthBearerOptions);
}
示例5: ConfigureAuth
// 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);
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
// clientId: "",
// clientSecret: "");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
app.UseFacebookAuthentication(
appId: "880767911941257",
appSecret: "a4e12738d4bddde8a9f9033a8bc9c626");
app.UseGoogleAuthentication(
clientId: "592054785953-f0l2eeahhbgf7hpgp9rcdprarsb0gvrh.apps.googleusercontent.com",
clientSecret: "asPc3j-Q5EkLZVBXEo41B5tr");
}
示例6: ConfigureAuth
// Pour plus d’informations sur la configuration de l’authentification, rendez-vous sur http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
// Autoriser l’application à utiliser un cookie pour stocker des informations pour l’utilisateur connecté
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);
// Supprimer les commentaires des lignes suivantes pour autoriser la connexion avec des fournisseurs de connexions tiers
//app.UseMicrosoftAccountAuthentication(
// clientId: "",
// clientSecret: "");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
app.UseFacebookAuthentication(
appId: "1677086355911298",
appSecret: "01abf5673bdcb38e4a773dc617137487");
//app.UseGoogleAuthentication();
}
示例7: ConfigureAuth
// 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);
// Uncomment the following lines to enable logging in with third party login providers
app.UseMicrosoftAccountAuthentication(
clientId: "0000000040110865",
clientSecret: "sk6T9LprRnHlnk74IJmz6z5NcAjyGKtm");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
app.UseFacebookAuthentication(
appId: "244418352318084",
appSecret: "f39b49a290337ef6d848723cea64507b");
app.UseGoogleAuthentication();
}
示例8: ConfigureAuth
// 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);
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
// clientId: "",
// clientSecret: "");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
app.UseFacebookAuthentication(
appId: "133426213508895",
appSecret: "fc61d3139052096dcab386dd17b54b70");
app.UseGoogleAuthentication();
}
示例9: ConfigureAuth
// 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);
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
// clientId: "",
// clientSecret: "");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
//app.UseFacebookAuthentication(
// appId: "",
// appSecret: "");
var facebookAuthenticationOptions = new FacebookAuthenticationOptions
{
AppId = "1480656632147712",
AppSecret = "971e8d74e63d9a6a5e676bebd5c134ff"
};
facebookAuthenticationOptions.Scope.Add("email");
app.UseFacebookAuthentication(facebookAuthenticationOptions);
app.UseGoogleAuthentication();
}
示例10: ConfigureAuth
// 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);
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
// clientId: "",
// clientSecret: "");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
app.UseFacebookAuthentication(
appId: "460137580825206",
appSecret: "");
app.UseGoogleAuthentication(clientId: "-nq90vhijsnjdtplr12n39rdaeprql98m.apps.googleusercontent.com", clientSecret: "");
}
示例11: ConfigureAuth
// 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
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Enable the application to use bearer tokens to authenticate users
app.UseOAuthBearerTokens(OAuthOptions);
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
// clientId: "",
// clientSecret: "");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
app.UseFacebookAuthentication(
appId: "yourappid",
appSecret: "yourappsecret");
//app.UseGoogleAuthentication();
}
示例12: ConfigureAuth
// 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("/Cheetah/UserAccount/Login")
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
// clientId: "0000000044101607",
// clientSecret: "CHfsN46nyXCEWAhB8LkJc3fLPSfg7uJh");
//app.UseTwitterAuthentication(
// consumerKey: "76a8dqXzLrKEaAYP9AmdfnD5l",
// consumerSecret: "gnHfZQIXjcAIqDf5AxC3gslD3dIgjHeuEpA1RBgAvcSfQ4uRd3");
app.UseFacebookAuthentication(
appId: "600065163358974",
appSecret: "71438dd894d191bd161a69720fbf10e1");
app.UseGoogleAuthentication(clientId: "212507878610-9jd5t3vggkc8soi27ou449foi2cropau.apps.googleusercontent.com", clientSecret: "UiJxJI83jTt1XWpYZvxDxd0I");
}
示例13: ConfigureAuth
public void ConfigureAuth(IAppBuilder app)
{
app.CreatePerOwinContext(MyFollowContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationRoleManager>(ApplicationRoleManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser, int>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentityCallback: (manager, user) => user.GenerateUserIdentityAsync(manager),
getUserIdCallback: (claim) => int.Parse(claim.GetUserId()))
}
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
app.UseFacebookAuthentication(
appId: "946468195376138",
appSecret: "e327c6fcd1540a1e215c5b14d3684b11");
//app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
//{
// ClientId = "1015938086259-kc2u0pt7etjp91rfv1mfemtceb8nlng0.apps.googleusercontent.com",
// ClientSecret = "bfFVTrn60mcwHmKRQGFXze3n"
//});
}
示例14: ConfigureAuth
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
app.UseCors(new CorsOptions {PolicyProvider = new CustomOwinCorsPolicyProvider()});
// Enable the application to use a cookie to store information for the signed in user
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Enable the application to use bearer tokens to authenticate users
app.UseOAuthBearerTokens(OAuthOptions);
// Uncomment the following lines to enable logging in with third party login providers
app.UseMicrosoftAccountAuthentication(
clientId: ConfigurationManager.AppSettings.Get("OAuthMicrosoftKey"),
clientSecret: ConfigurationManager.AppSettings.Get("OAuthMicrosoftSecret"));
app.UseTwitterAuthentication(
consumerKey: ConfigurationManager.AppSettings.Get("OAuthTwitterKey"),
consumerSecret: ConfigurationManager.AppSettings.Get("OAuthTwitterSecret"));
app.UseFacebookAuthentication(
appId: ConfigurationManager.AppSettings.Get("OAuthFacebookKey"),
appSecret: ConfigurationManager.AppSettings.Get("OAuthFacebookSecret"));
app.UseGoogleAuthentication();
}
示例15: Configure
public static void Configure(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ExternalCookie
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Configure google authentication
var options = new GoogleOAuth2AuthenticationOptions()
{
ClientId = "your app client id",
ClientSecret = "your app client secret"
};
app.UseGoogleAuthentication(options);
facebookAuthOptions = new FacebookAuthenticationOptions()
{
AppId = "528982800546743",
AppSecret = "a6ee5ad8448c7c67fcedc72d5a4c501a",
Provider = new FacebookAuthProvider()
};
app.UseFacebookAuthentication(facebookAuthOptions);
}