【发布时间】:2014-05-27 12:38:41
【问题描述】:
.NET 4.5 现在有这些不同的身份验证方式,但我没有看到 LinkedIn 有一种方式。有没有人知道 .NET 4.5 是否有内置的方法来使用 LinkedIn 进行 oAuth?
using Microsoft.AspNet.Identity;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
namespace WebPageStarterKit
{
public partial class Startup {
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301883
public void ConfigureAuth(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
// and also store information about a user logging in with a third party login provider.
// This is required if your application allows users to login
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
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: "");
//app.UseGoogleAuthentication();
}
}
}
【问题讨论】:
-
如果有人能这么好心地祝福这个社区并解决我的问题,那将是非凡的。
-
你想用 twitter 验证,还是做更多的事情(发布等)?
-
我只是担心LinkedIN
-
使用nuget获取全系列Owin.Security.Providers github.com/owin-middleware/OwinOAuthProviders