[英]Equivalent to GetExternalAuthenticationTypes() in ASP.NET Core 2.0?
I've spent a long time trying to convert an ASP.NET 5.0 app to ASP.NET Core 2 and I just can't find a few things. 我花了很长时间尝试将ASP.NET 5.0应用程序转换为ASP.NET Core 2,但我发现了一些东西。 I'm trying to get the list of external providers (Google, Facebook, etc.) that are supported by the current installation.
我正在尝试获取当前安装所支持的外部提供程序(Google,Facebook等)的列表。 Pre Core, I would have used:
Pre Core,我会用过:
Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes()
Of course, I can't use that anymore due to the OWIN reference, but I haven't been able to find a similar function anywhere else either. 当然,由于有OWIN参考,我不能再使用它了,但是我也无法在其他任何地方找到类似的功能。 I don't want to have to set it manually.
我不想手动设置它。 Is there a sample of using this to create a nice social login page?
是否有使用此示例创建漂亮的社交登录页面的示例? Any help would be much appreciated!
任何帮助将非常感激!
Do you need SignInManager.GetExternalAuthenticationSchemesAsync
? 您是否需要
SignInManager.GetExternalAuthenticationSchemesAsync
?
var loginProviders = (await SignInManager.GetExternalAuthenticationSchemesAsync()).ToList();
<div>
<p>
@foreach (var provider in loginProviders)
{
<button type="submit" class="btn btn-default" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">@provider.DisplayName</button>
}
</p>
</div>
</form>
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.