I have a user flow B2C_1_singupsingin1 I added an api connector, embed it in this stream and the endpoint url for the API call. Used article: https://learn.microsoft.com/en-us/azure/active-directory-b2c/add-api-connector-token-enrichment?pivots=b2c-user-flow
It is clear from the article that the API connector materializes as an HTTP POST request, sending custom attributes.
My web api has an endpoint with the code:
[HttpPost("enrich")]
public IActionResult Enrich([FromBody] JsonElement body)
{
var responseProperties = new Dictionary<string, object> //for example
{
{ "version", "1.0.0" },
{ "action", "Continue" },
{ "postalCode", "12349" },
{ "userId", 123 }
};
return new JsonResult(responseProperties) { StatusCode = 200 };
}
When I start a custom flow everything works, I get to that endpoint in api.
But there is a problem JsonElement body does't contain custom attributes. Inside I see body.ValueKind = Undefined
.
Tell me what am I doing wrong?
Also, after all, I wanted to add a custom "userId" claim with some value from my database. So that it is contained in the token issued in the subsequent. Would the code above be correct for this?