如何为microsoft-identity-web提供login_hint



我使用microsoft-identity-web (https://github.com/AzureAD/microsoft-identity-web)与IdentityServer4结合使用,通过AAD帐户的身份服务器4登录到我的应用程序。一切都很好。

我想知道是否有可能提供一个login_hint到Microsoft -identity-web,以便在Microsoft登录表单的名称字段可以预先填充。

事实证明,您可以通过向身份验证属性提供登录提示来将用户名传递给外部身份验证流,如下所示:

// start challenge and roundtrip the return URL and scheme 
var props = new AuthenticationProperties
{
RedirectUri = redirectUrl,
Items = {{"provider", provider.AuthenticationScheme}},
Parameters = {{ "login_hint", <user name to display in login screen>}}
};
return Challenge(props, provider.AuthenticationScheme);

有关如何使用外部身份提供程序(如Microsoft)进行签名的信息,请参见http://docs.identityserver.io/en/latest/topics/signin_external_providers.html。

最新更新