Forum Discussion
AADToken from react custom visual
- 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 LearnThis 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 CommunityIf 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.
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.
- v-veshwara-msft5 months ago
Community Support
Hi jananigurusamy ,
Just wanted to check if the response provided was helpful. If further assistance is needed, please reach out.
Thank you.