Forum Discussion

jananigurusamy's avatar
jananigurusamy
New Member
5 months ago
Solved

AADToken from react custom visual

Building react custom visual which should generate user token and pass it to external API on some user action in visual. But am getting PrivilegeStatus.NotSupported in acquireAADTokenstatus(). Upload...
  • v-veshwara-msft's avatar
    5 months ago

    Hi jananigurusamy ,

    Thanks for raising this in Microsoft Fabric Community.

    Publishing a visual to AppSource by itself is not sufficient for acquireAADToken() to work. Based on the official documentation, the API is supported only for AppSource visuals that are approved, and in other contexts such as organizational or uncertified visuals it can return PrivilegeStatus.NotSupported, which aligns with what you are seeing.

    You can refer to the documentation here:
    The authentication API in Power BI custom visuals - Power BI | Microsoft Learn

    This mentions that the Authentication API applies to AppSource visuals and may return NotSupported when the visual is not in a supported state.

     

    At the same time, there are some constraints around certification to be aware of. Certified visuals are required to follow strict validation rules, including limitations around external service calls. Because of this, scenarios where a visual needs to pass the user’s AAD token to an external API may be difficult to align with certification requirements.

     

    In similar discussions, one approach that is considered is to handle authentication outside of the custom visual. For example, the visual can call a backend service, and that service can manage authentication (for instance using a service principal or managed identity) before calling the external API. This helps avoid relying on token acquisition within the visual itself.

    You may find this related discussion useful:
    Using the Power BI Authentication API returns acce... - Microsoft Fabric Community

    If your requirement depends on user-context access, it might be worth exploring whether a backend-mediated approach would fit your scenario.

     

    Hope this helps. Please reach out for further assistance.
    Thank you.