I have a requirement to get date of birth of user to register with date only (without time) - Scenario 1.
But on another scenario flow in the same policy, I have a URL parameter (a token) with which I will call a REST API and get the user information from another application. In this case, the REST API is written by me to fetch the third party data and return to b2c custom policy.
I created a claim for date of birth with data type "date" and it works fine for scenario 1, where it obtains date of birth from user through self asserted input.
<ClaimType Id="dateOfBirth">
<DisplayName>Date of Birth</DisplayName>
<DataType>date</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="birth_date" />
<Protocol Name="OpenIdConnect" PartnerClaimType="birth_date" />
<Protocol Name="SAML2" PartnerClaimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/birthdate" />
</DefaultPartnerClaimTypes>
<UserInputType>DateTimeDropdown</UserInputType>
<PredicateValidationReference Id="CustomDateRange" />
</ClaimType>
But for scenario 2, the REST API can only return as DateTime or string. When I try to execute this policy where REST API returns dateOfBirth as string, then B2C throws error when REST API returns the value - In AppInsights I see that:
The data type 'String' of the claim with id 'dateOfBirth' does not match the DataType 'Date' of ClaimType with id 'dateOfBirth' specified in the policy
If I change the REST API dateOfBirth as DateTime, then it throws like:
The data type 'DateTime' of the claim with id 'dateOfBirth' does not match the DataType 'Date' of ClaimType with id 'dateOfBirth' specified in the policy.
Can someone please help?
Thanks in advance.