title: Email missing in Claim - How to find what is passing from B2C and fix?
body: <p>We have configured to reach B2C via CRM Portal and using custom policies. On Redirect back from signin for a local account to CRM we get the following error</p>
  
  <blockquote>
    <p>Server Error in '/' Application.
    Value cannot be null.
    Parameter name: email</p>
  </blockquote>
  
  <p>So trying to figure out why email is not being sent as a claim back?</p>
  
  <p>1) How do we find out all the claims being sent back from B2C to CRM?</p>
  
  <p>2) Our SignupOrSignin.xml has the following</p>
  
  <pre><code>  &lt;OutputClaims&gt;
      &lt;OutputClaim ClaimTypeReferenceId="displayName" /&gt;
      &lt;OutputClaim ClaimTypeReferenceId="givenName" /&gt;
      &lt;OutputClaim ClaimTypeReferenceId="surname" /&gt;
      &lt;OutputClaim ClaimTypeReferenceId="email" /&gt;
      &lt;OutputClaim ClaimTypeReferenceId="objectId" PartnerClaimType="sub"/&gt;
      &lt;OutputClaim ClaimTypeReferenceId="identityProvider" /&gt;
      &lt;OutputClaim ClaimTypeReferenceId="trustFrameworkPolicy" Required="true" DefaultValue="{policy}" /&gt;
    &lt;/OutputClaims&gt;
  </code></pre>
  
  <p>So we assumed email is being sent back but ofcourse not.</p>
  
  <p>What could be wrong in the userjourney?</p>
  
  <pre><code>&lt;UserJourney Id="SignUpOrSignIn"&gt;
    &lt;OrchestrationSteps&gt;
  
      &lt;OrchestrationStep Order="1" Type="CombinedSignInAndSignUp" ContentDefinitionReferenceId="api.signuporsignin"&gt;
        &lt;ClaimsProviderSelections&gt;
          &lt;ClaimsProviderSelection ValidationClaimsExchangeId="LocalAccountSigninEmailExchange" /&gt;
        &lt;/ClaimsProviderSelections&gt;
        &lt;ClaimsExchanges&gt;
          &lt;ClaimsExchange Id="LocalAccountSigninEmailExchange" TechnicalProfileReferenceId="SelfAsserted-LocalAccountSignin-Email" /&gt;
        &lt;/ClaimsExchanges&gt;
      &lt;/OrchestrationStep&gt;
  
      &lt;OrchestrationStep Order="2" Type="ClaimsExchange"&gt;
        &lt;Preconditions&gt;
          &lt;Precondition Type="ClaimsExist" ExecuteActionsIf="true"&gt;
            &lt;Value&gt;objectId&lt;/Value&gt;
            &lt;Action&gt;SkipThisOrchestrationStep&lt;/Action&gt;
          &lt;/Precondition&gt;
        &lt;/Preconditions&gt;
        &lt;ClaimsExchanges&gt;
         &lt;ClaimsExchange Id="FacebookExchange" TechnicalProfileReferenceId="Facebook-OAUTH" /&gt;
          &lt;ClaimsExchange Id="SignUpWithLogonEmailExchange" TechnicalProfileReferenceId="LocalAccountSignUpWithLogonEmail" /&gt;
        &lt;/ClaimsExchanges&gt;
      &lt;/OrchestrationStep&gt;
  
      &lt;!-- For social IDP authentication, attempt to find the user account in the directory. --&gt;
      &lt;OrchestrationStep Order="3" Type="ClaimsExchange"&gt;
        &lt;Preconditions&gt;
          &lt;Precondition Type="ClaimEquals" ExecuteActionsIf="true"&gt;
            &lt;Value&gt;authenticationSource&lt;/Value&gt;
            &lt;Value&gt;localAccountAuthentication&lt;/Value&gt;
            &lt;Action&gt;SkipThisOrchestrationStep&lt;/Action&gt;
          &lt;/Precondition&gt;
        &lt;/Preconditions&gt;
        &lt;ClaimsExchanges&gt;
          &lt;ClaimsExchange Id="AADUserReadUsingAlternativeSecurityId" TechnicalProfileReferenceId="AAD-UserReadUsingAlternativeSecurityId-NoError" /&gt;
        &lt;/ClaimsExchanges&gt;
      &lt;/OrchestrationStep&gt;
  
      &lt;!-- Show self-asserted page only if the directory does not have the user account already (i.e. we do not have an objectId). 
        This can only happen when authentication happened using a social IDP. If local account was created or authentication done
        using ESTS in step 2, then an user account must exist in the directory by this time. --&gt;
      &lt;OrchestrationStep Order="4" Type="ClaimsExchange"&gt;
        &lt;Preconditions&gt;
          &lt;Precondition Type="ClaimsExist" ExecuteActionsIf="true"&gt;
            &lt;Value&gt;objectId&lt;/Value&gt;
            &lt;Action&gt;SkipThisOrchestrationStep&lt;/Action&gt;
          &lt;/Precondition&gt;
        &lt;/Preconditions&gt;
        &lt;ClaimsExchanges&gt;
          &lt;ClaimsExchange Id="SelfAsserted-Social" TechnicalProfileReferenceId="SelfAsserted-Social" /&gt;
        &lt;/ClaimsExchanges&gt;
      &lt;/OrchestrationStep&gt;
  
      &lt;!-- This step reads any user attributes that we may not have received when authenticating using ESTS so they can be sent 
        in the token. --&gt;
      &lt;OrchestrationStep Order="5" Type="ClaimsExchange"&gt;
        &lt;Preconditions&gt;
          &lt;Precondition Type="ClaimEquals" ExecuteActionsIf="true"&gt;
            &lt;Value&gt;authenticationSource&lt;/Value&gt;
            &lt;Value&gt;socialIdpAuthentication&lt;/Value&gt;
            &lt;Action&gt;SkipThisOrchestrationStep&lt;/Action&gt;
          &lt;/Precondition&gt;
        &lt;/Preconditions&gt;
        &lt;ClaimsExchanges&gt;
          &lt;ClaimsExchange Id="AADUserReadWithObjectId" TechnicalProfileReferenceId="AAD-UserReadUsingObjectId" /&gt;
        &lt;/ClaimsExchanges&gt;
      &lt;/OrchestrationStep&gt;
  
  
  
      &lt;!-- The previous step (SelfAsserted-Social) could have been skipped if there were no attributes to collect 
           from the user. So, in that case, create the user in the directory if one does not already exist 
           (verified using objectId which would be set from the last step if account was created in the directory. --&gt;
      &lt;OrchestrationStep Order="6" Type="ClaimsExchange"&gt;
        &lt;Preconditions&gt;
          &lt;Precondition Type="ClaimsExist" ExecuteActionsIf="true"&gt;
            &lt;Value&gt;objectId&lt;/Value&gt;
            &lt;Action&gt;SkipThisOrchestrationStep&lt;/Action&gt;
          &lt;/Precondition&gt;
        &lt;/Preconditions&gt;
        &lt;ClaimsExchanges&gt;
          &lt;ClaimsExchange Id="AADUserWrite" TechnicalProfileReferenceId="AAD-UserWriteUsingAlternativeSecurityId" /&gt;
        &lt;/ClaimsExchanges&gt;
      &lt;/OrchestrationStep&gt;
  
      &lt;!-- Phone verification: If MFA is not required, the next three steps (#5-#7) should be removed.
           This step checks whether there's a phone number on record,  for the user. If found, then the user is challenged to verify it. --&gt;
      &lt;OrchestrationStep Order="7" Type="ClaimsExchange"&gt;
        &lt;Preconditions&gt;
          &lt;Precondition Type="ClaimsExist" ExecuteActionsIf="true"&gt;
            &lt;Value&gt;isActiveMFASession&lt;/Value&gt;
            &lt;Action&gt;SkipThisOrchestrationStep&lt;/Action&gt;
          &lt;/Precondition&gt;
        &lt;/Preconditions&gt;
        &lt;ClaimsExchanges&gt;
          &lt;ClaimsExchange Id="PhoneFactor-Verify" TechnicalProfileReferenceId="PhoneFactor-InputOrVerify" /&gt;
        &lt;/ClaimsExchanges&gt;
      &lt;/OrchestrationStep&gt;
  
  
  
      &lt;!-- Save MFA phone number: The precondition verifies whether the user provided a new number in the 
           previous step. If so, then the phone number is stored in the directory for future authentication 
           requests. --&gt;
      &lt;OrchestrationStep Order="8" Type="ClaimsExchange"&gt;
        &lt;Preconditions&gt;
          &lt;Precondition Type="ClaimsExist" ExecuteActionsIf="false"&gt;
            &lt;Value&gt;newPhoneNumberEntered&lt;/Value&gt;
            &lt;Action&gt;SkipThisOrchestrationStep&lt;/Action&gt;
          &lt;/Precondition&gt;
        &lt;/Preconditions&gt;
        &lt;ClaimsExchanges&gt;
          &lt;ClaimsExchange Id="AADUserWriteWithObjectId" TechnicalProfileReferenceId="AAD-UserWritePhoneNumberUsingObjectId" /&gt;
        &lt;/ClaimsExchanges&gt;
      &lt;/OrchestrationStep&gt;
  
      &lt;OrchestrationStep Order="9" Type="SendClaims" CpimIssuerTechnicalProfileReferenceId="JwtIssuer" /&gt;
  
    &lt;/OrchestrationSteps&gt;
    &lt;ClientDefinition ReferenceId="DefaultWeb" /&gt;
  &lt;/UserJourney&gt;
  </code></pre>
  
  <p>AAD-UserReadUsingObjectId</p>
  
  <pre><code>    &lt;TechnicalProfile Id="AAD-UserReadUsingObjectId"&gt;
        &lt;Metadata&gt;
          &lt;Item Key="Operation"&gt;Read&lt;/Item&gt;
          &lt;Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist"&gt;true&lt;/Item&gt;
        &lt;/Metadata&gt;
        &lt;IncludeInSso&gt;false&lt;/IncludeInSso&gt;
        &lt;InputClaims&gt;
          &lt;InputClaim ClaimTypeReferenceId="objectId" Required="true" /&gt;
        &lt;/InputClaims&gt;     
        &lt;OutputClaims&gt;
          &lt;OutputClaim ClaimTypeReferenceId="strongAuthenticationPhoneNumber" /&gt;
          &lt;OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" /&gt;
          &lt;OutputClaim ClaimTypeReferenceId="displayName" /&gt;
          &lt;OutputClaim ClaimTypeReferenceId="otherMails" /&gt;
          &lt;OutputClaim ClaimTypeReferenceId="givenName" /&gt;
          &lt;OutputClaim ClaimTypeReferenceId="surname" /&gt;
          &lt;OutputClaim ClaimTypeReferenceId="extension_mustResetPassword" /&gt;
        &lt;/OutputClaims&gt;
        &lt;IncludeTechnicalProfile ReferenceId="AAD-Common" /&gt;
      &lt;/TechnicalProfile&gt;
  </code></pre>