ASP.NET Core 2.0中的LinkedIn外部登录 [英] LinkedIn External Login in ASP.NET Core 2.0

查看:81
本文介绍了ASP.NET Core 2.0中的LinkedIn外部登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现外部登录,并且Facebook和Google都没有问题,因为它们得到了支持,但是我仍然停留在LinkedIn上.我不完全是一个初学者,但是我对此也不是很有经验.在发布这篇文章之前,我查看了上千种解释,其中大多数是模糊的,其他只是不起作用,而其他则是为高级人士解释的.

I need to implement external logins and had no problem with Facebook and Google since they are supported but I'm stuck at LinkedIn. I am not exactly a beginner but I'm not very experienced at this either. Prior to this post I viewed a thousand explanations and most of them were vague, others just didn't work and others were explained for advanced people.

我尝试过的事情:

-在Configure方法中使用cookie,但是不赞成使用这些方法(我认为它们不适用于2.0版本).我也尝试从Microsoft.AspNetCore.Authentication.LinkedIn尝试app.UseLinkedInAuthentication(...)失败.

-using cookies in the Configure method, but the methods were deprecated (I figured they were not for the 2.0 version). I also tried app.UseLinkedInAuthentication(...) from Microsoft.AspNetCore.Authentication.LinkedIn to no success.

-在ConfigureServices中编写服务(但是我没有让它正常工作,我认为这是我需要做的地方).我还尝试了,但是它们说话就像他们知道自己在做什么.

-writing a service in ConfigureServices (but I didn't get it to work, I assume this is where I need to do it). I also tried this but they were talking like they knew what they were doing.

因此,为了简单起见,我在Visual Studio 2017中创建了默认的MVC ASP.NET Core 2.0应用程序.我要做的就是在Startup.cs中编写内容,所以我的问题是,那是什么我必须写,为什么?预先非常感谢.

PS:我希望在评论中进行解释,如果它是我可能已经访问过的链接:)

推荐答案

AspNet.Security.OAuth.Providers存储库,该存储库提供了一组安全中间件来支持社交身份验证提供程序. 可以使用此链接找到相应的发行版: https://www.nuget.org/profiles/aspnet -contrib (所有从AspNet.Security.OAuth开始的软件包)

There is AspNet.Security.OAuth.Providers repo that provides a collection of security middleware to support social authentication providers. Corresponding releases can be found using this link: https://www.nuget.org/profiles/aspnet-contrib (all packages that start from AspNet.Security.OAuth)

不幸的是,当前的master分支仅适用于ASP.NET Core 1.0,因此像软件包,但您可以克隆该存储库并切换到

Unfortunately, the current master branch is only for ASP.NET Core 1.0 and so nuget packages like package for LinkedIn were published only for that version, but you may clone the repo and switch to experimental branch that is an on-going port to ASP.NET Core 2.0.

查看此github问题如果需要当前的移植状态.

Look into this github issue if you need the current status of porting.

顺便说一下,根据此github问题,LinkedIn身份验证提供程序已被移植.

By the way, according to this github issue, the LinkedIn authentication provider has been ported already.

这篇关于ASP.NET Core 2.0中的LinkedIn外部登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆