我正在尝试在我正在创建的.net核心Web应用程序解决方案中使用第三方登录身份验证。我正在尝试使用Owin包来这样做。我在.net框架中查看过Owin的一个例子,我一直试图将其转换为.net核心应用程序,但我一直都很失败。
如果有人可以指出我使用Owin进行第三方身份验证的.net核心Web应用程序的示例,我们将不胜感激。
以下是框架Web应用程序的启动文件:
using Microsoft.AspNet.Identity;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.Facebook;
using Microsoft.Owin.Security.Google;
using Owin;
[assembly: OwinStartupAttribute(typeof(Identity.Startup))]
namespace Identity
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
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: "myid",
appSecret: "mysecret");
//app.UseGoogleAuthentication();
}
}
我想立即在.net核心中复制它。但是,我无法重现Microsoft.Owin.Security依赖项。我已经尝试过Microsoft.AspNetCore.Owin.Security但它没有解决。