C# 如何使用.NET 4.5 Owin向LinkedIn进行身份验证

C# 如何使用.NET 4.5 Owin向LinkedIn进行身份验证,c#,.net,oauth,linkedin,C#,.net,Oauth,Linkedin,.NET4.5现在有这些不同的身份验证方法,但我看不到LinkedIn有这样的方法。有人知道.NET4.5是否有一种内置的方式可以通过LinkedIn连接到oAuth吗 using Microsoft.AspNet.Identity; using Microsoft.Owin; using Microsoft.Owin.Security.Cookies; using Owin; namespace WebPageStarterKit { public partial class Sta

.NET4.5现在有这些不同的身份验证方法,但我看不到LinkedIn有这样的方法。有人知道.NET4.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();
        }
    }
}
我不确定“内置”。。。但是您可以使用nuget获得另一个OWIN包

查看这个网站,了解一个非常简单的教程

简言之:

  • 使用nuget安装此软件包:Owin.Security.Providers
  • 注册LinkedIn开发者帐户,网址为
  • 请求API密钥。填写完表格后,请记下API密钥和密钥
  • 编辑您的应用程序\u Start\Startup.Auth.cs文件以包括“使用Owin.Security.Providers.Linkedin”
  • 在该文件的底部,为LinkedIn添加一个部分:

        app.UseLinkedInAuthentication(new LinkedInAuthenticationOptions() 
        {
            ClientId = "API Key",
            ClientSecret = "Secret Key",
        });
    

  • 如果有人能如此好心地为这个社区提供我的问题的解决方案,那将是非常了不起的。你想用twitter验证,还是做更多(帖子等)?我只是担心LinkedIn使用nuget获得全方位的Owin.Security.Providers,而这在理论上可能会回答这个问题,在这里包括答案的基本部分,并提供链接供参考。