我看到了很多文章,有脸书和Twitter处理程序在MVC 4默认模板上使用visual studio 2012.But,但我的模板中没有。那么,默认情况下我应该做些什么来启用它呢?

更新:,实际上我不需要知道OAuth的实现,我只需要知道默认模板是否有上面提到的Facebook和Twitter的UI组件(红色)?
发布于 2013-05-12 12:25:28
您需要在OAuth文件中取消对Facebook和Twitter的App_Code/AuthConfig.cs身份验证进行注释。一旦你这样做,你将需要注册到Facebook,你的应用程序,以获得安全密钥。一旦您这样做,您应该能够使用Facebook和/或Twitter作为身份验证服务。
AuthConfig.cs看起来如下所示:
public static class AuthConfig
{
public static void RegisterAuth()
{
// To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
// you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166
//OAuthWebSecurity.RegisterMicrosoftClient(
// clientId: "",
// clientSecret: "");
OAuthWebSecurity.RegisterTwitterClient(
consumerKey: "",
consumerSecret: "");
OAuthWebSecurity.RegisterFacebookClient(
appId: "",
appSecret: "");
//OAuthWebSecurity.RegisterGoogleClient();
}
}此外,还可以看一看这篇CodeProject文章,它将指导在MVC 4:OAuth在ASP.NET MVC中的介绍中使用OAuth的过程。
更新:如果您的更新,我的答案将不是完全的解决方案。
https://stackoverflow.com/questions/16507176
复制相似问题