Azure B2C自定义声明extension_Phone在编辑配置文件策略中无法保存
自定义声明未加入持久化输出列表
检查负责用户数据持久化的技术配置文件(如AAD-UserWriteProfileUsingObjectId),确认是否将extension_Phone添加到<OutputClaims>中。内置声明givenName和surname默认会被持久化,但自定义声明需要显式声明才能被写入用户存储。示例配置:<OutputClaims> <OutputClaim ClaimTypeReferenceId="givenName" /> <OutputClaim ClaimTypeReferenceId="surname" /> <OutputClaim ClaimTypeReferenceId="extension_Phone" /> <!-- 必须添加此行 --> </OutputClaims>ClaimType定义未启用持久化
查看extension_Phone的ClaimType配置,确保<Persisted>属性设置为true。如果该属性缺失或设为false,即使用户输入了值,系统也不会将其持久化。示例配置:<ClaimType Id="extension_Phone"> <DisplayName>Phone Number</DisplayName> <DataType>string</DataType> <UserInputType>TextBox</UserInputType> <Persisted>true</Persisted> <!-- 关键配置 --> </ClaimType>SelfAsserted技术配置文件未传递输出声明
在SelfAsserted-ProfileUpdate技术配置文件中,必须同时在<InputClaims>和<OutputClaims>中声明extension_Phone。如果仅添加到输入列表,用户输入的值不会被传递到后续的持久化步骤,导致无法保存。自定义声明命名空间错误
自定义声明的ID必须遵循extension_<应用ID(去除连字符)>_Phone的格式。例如应用ID为12345678-1234-1234-1234-1234567890ab,则正确的声明ID应为extension_123456781234123412341234567890ab_Phone。命名空间不匹配会导致系统无法找到对应的存储字段,从而无法保存数据。持久化应用权限不足
检查用于用户数据更新的B2C扩展应用,确保其已被授予Directory.ReadWrite.All权限并获得管理员同意。权限不足会导致系统静默失败,无法将自定义声明写入用户存储。
内容的提问来源于stack exchange,提问作者Anna Melashkina

