Azure B2C自定义扩展策略报错:提示缺DataType但实际已配置
Azure B2C自定义扩展策略Schema验证错误:缺少DataType属性
问题原因
你遇到的错误并非因为已定义的email、inviteToken等ClaimType缺少DataType,而是策略中引用了未在<ClaimsSchema>里声明的newPassword和reenterPassword这两个ClaimType。Azure B2C要求所有在策略中使用的ClaimType必须明确配置DataType,即使是常见的密码类型也不例外。
在你的SelfAsserted-LocalAccountSignUp-ReadOnlyEmail技术配置文件的<OutputClaims>节点中,你使用了这两个未定义的ClaimType,这直接触发了Schema验证错误。
解决方案
在<ClaimsSchema>节点下添加newPassword和reenterPassword的ClaimType定义,示例代码如下:
<BuildingBlocks> <ClaimsSchema> <!-- 原有ClaimType定义 --> <ClaimType Id="email"> <DisplayName>Email Address</DisplayName> <DataType>string</DataType> <DefaultPartnerClaimTypes> <Protocol Name="OAuth2" PartnerClaimType="email"/> </DefaultPartnerClaimTypes> <UserHelpText>Email used to sign in</UserHelpText> </ClaimType> <!-- 其他原有ClaimType... --> <!-- 添加以下两个ClaimType --> <ClaimType Id="newPassword"> <DisplayName>New Password</DisplayName> <DataType>string</DataType> <UserHelpText>Enter your new password</UserHelpText> <UserInputType>Password</UserInputType> </ClaimType> <ClaimType Id="reenterPassword"> <DisplayName>Confirm Password</DisplayName> <DataType>string</DataType> <UserHelpText>Re-enter your password to confirm</UserHelpText> <UserInputType>Password</UserInputType> </ClaimType> </ClaimsSchema> <!-- 其他BuildingBlocks内容... --> </BuildingBlocks>
添加完成后,重新上传自定义扩展策略即可通过Schema验证。
内容的提问来源于stack exchange,提问作者Ret 2
相关产品推荐
相关产品推荐

