0
votes

I am developing a RESTful Service, which gets called during the Signup/Signin Process in Azure AD B2C. My Service logs state, that data successfully arrives, and output-claims (customerId) get created.

But I receive the following error message, and the user doesn't get created:

AADB2C90161 A self-asserted send response has failed with reason (Internal Server Error).
Correlation ID 7eac5fd2-cd85-4535-b166-4cc8f0264d07

I have oriented myself towards this example: https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/tree/master/scenarios/aadb2c-ief-rest-api-netfw/

Did anyone experience similar issues and has a hint what could be the problem in my case?

in TrustFrameworkExtension:

<ClaimsProvider>
  <DisplayName>KTM REST APIs</DisplayName>
  <TechnicalProfiles>
    <TechnicalProfile Id="REST-API-SignUp">
      <DisplayName>Generate and return customerID claim</DisplayName>
      <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <Metadata>
        <Item Key="ServiceUrl">https://<my.service.com>/api/Identity/Signup</Item>
        <Item Key="AuthenticationType">None</Item>
        <Item Key="SendClaimsIn">Body</Item>
      </Metadata>

      <InputClaims>          
        <InputClaim ClaimTypeReferenceId="email" PartnerClaimType="Email" />
        <InputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="FirstName" />
        <InputClaim ClaimTypeReferenceId="surname" PartnerClaimType="LastName" />
        <InputClaim ClaimTypeReferenceId="testClaim" PartnerClaimType="ObjectId" />           
      </InputClaims>
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="customerId" PartnerClaimType="CustomerId" />
      </OutputClaims>
      <UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
    </TechnicalProfile>

    <TechnicalProfile Id="LocalAccountSignUpWithLogonEmail">
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="customerId" PartnerClaimType="CustomerId" />
      </OutputClaims>
      <ValidationTechnicalProfiles>
        <ValidationTechnicalProfile ReferenceId="REST-API-SignUp" />
      </ValidationTechnicalProfiles>
    </TechnicalProfile>
  </TechnicalProfiles>
</ClaimsProvider>
1
did you add any persisted claims? - Ramakrishna

1 Answers

0
votes

In this case, you have a run-time error. The claim type "customerId" is defined as a string in the policy, but looks like the value coming over the wire (where partnerClaimType is "CustomerId") is a number, so the system is unable to map it. See this line:

<OutputClaim ClaimTypeReferenceId="customerId" PartnerClaimType="CustomerId" />

This is how a Rest API will return a string vs a number (note the absence of quotes in a number):

{
   "name": "John",
   "age": 24
}

While this message can be improved, you should configure your policy to collect logs using Application Insights. This will allow you to debug similar run-time issues more easily.