I’m facing a challenge with the custom policy in Azure AD B2C. Even though the extension_inviteToken claim appears in the /authorize URL and is visible in the audit logs, it fails to be sent to my REST API endpoint. The API only receives either a null value or an empty object for the InviteToken.
Here’s how I have defined the claim:
<ClaimType Id="extension_inviteToken">
<DisplayName>Invite Token</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="extension_inviteToken" />
</DefaultPartnerClaimTypes>
</ClaimType>
For the REST API, my technical profile is as follows:
<TechnicalProfile Id="REST-GetEmailFromInviteToken">
<DisplayName>Get Email From Invite Token</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://api7502.ngrok.io/api/invite/validate</Item>
<Item Key="SendClaimsIn">Body</Item>
<Item Key="AuthenticationType">None</Item>
<Item Key="AllowInsecureAuthInProduction">true</Item>
<Item Key="DefaultUserMessageIfRequestFailed">Invite token missing or invalid.</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="extension_inviteToken" PartnerClaimType="InviteToken" Required="true" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="email" />
<OutputClaim ClaimTypeReferenceId="extension_accountName" />
<OutputClaim ClaimTypeReferenceId="extension_contactName" />
<OutputClaim ClaimTypeReferenceId="extension_inviteToken" />
</OutputClaims>
</TechnicalProfile>
Additionally, I have set up a debugging technical profile:
<TechnicalProfile Id="SelfAsserted-DebugInviteToken">
<DisplayName>Debug Invite Token</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider" />
<InputClaims>
<InputClaim ClaimTypeReferenceId="extension_inviteToken" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="extension_inviteToken" />
</OutputClaims>
</TechnicalProfile>
In the user journey, I have this orchestration step:
<OrchestrationStep Order="2" Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="DebugInviteToken" TechnicalProfileReferenceId="SelfAsserted-DebugInviteToken" />
</ClaimsExchanges>
</OrchestrationStep>
I’ve ensured not to include unnecessary claim transformations and have adhered to best practices throughout.
Here are some extra details:
- The /authorize URL contains the
extension_inviteToken=...and this is confirmed by the audit log. - The RelyingParty PolicyProfile includes:
<InputClaims>
<InputClaim ClaimTypeReferenceId="extension_inviteToken" />
</InputClaims>
- The REST API expects
{"InviteToken":"..."}format and works smoothly when tested with Postman. - All policies are uploaded in the right order, and there are no errors during the upload process.
- Yet, the API keeps receiving either
{}or{ "InviteToken": null }from B2C.
I’d appreciate any guidance on why the extension_inviteToken claim isn’t being relayed from the OIDC request to the REST API, especially since it seems all configurations and mappings have been set correctly.