简体   繁体   English

AAD B2C IEF:如何使用 costom 策略将错误代码和消息从 REST API 传递到应用程序?

[英]AAD B2C IEF: How to pass error code and message from REST API to the application with costom policy?

I'm using custom policy to invoke a REST API to get something from database and return in claims.我正在使用自定义策略调用 REST API 以从数据库中获取某些内容并在声明中返回。 It works fine but I need to extend the feature to send extra error code and error message in case any exception happens.它工作正常,但我需要扩展该功能以发送额外的错误代码和错误消息,以防发生任何异常。 I already returned such information as requested ("status":409, "userMessage":).我已经按要求返回了此类信息(“status”:409,“userMessage”:)。 But I don't know where I can get it (in HTTP header/body/somewhere else?).但我不知道在哪里可以得到它(在 HTTP 标头/正文/其他地方?)。 I understand that I can return such information in another claim.我了解我可以在另一项索赔中返回此类信息。 But since AAD B2C provides the status code and userMessage there must be a way to use it.但是由于 AAD B2C 提供了状态代码和 userMessage,因此必须有一种方法可以使用它。 Could someone please enlighten me?有人可以启发我吗? Thanks a lot.非常感谢。

enter image description here在此处输入图片说明

The error message itself can't be accessed as a claim.错误消息本身不能作为声明访问。 If you want processing to continue, then return a HTTP 200 with a JSON representing the error and use preconditions to control the journey in this case.如果您希望继续处理,则返回 HTTP 200 和表示错误的 JSON,并在这种情况下使用先决条件来控制旅程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM