Forum Discussion

Shlokyy's avatar
Shlokyy
Regular Visitor
2 years ago
Solved

How to use Power Bi Apis without Azure Aad.?

I am embedding power pi report in react, problem is access token is expired in one hour I want to refresh this token after 45 minute using power bi APIs but I don't have azure aad how can I refresh my token without azure ad, i have my own server can I host my power bi report there, and use there APIs to refresh tokens and send any post method to power bi..?

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Shlokyy ,
    Thanks for the reply, according to what the documentation indicates, you can't go and skip registering Azure AD to use the api to refresh the token.
    For more information on how to use the getNewUserAccessToken() function, you can refer to this thread
    Solved: How to implement getNewUserAccessToken() function ... - Microsoft Fabric Community


    Best regards,

    Albert He

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Shlokyy ,

    According to the documentation I've looked up, using the Power BI APIs (including those for token refresh and POST methods) requires authentication via Azure AD, which is a necessary step to ensure secure interaction with the Power BI service. If you want to refresh the token to get the latest token to refresh the report, you can either refresh the access token directly via setAccessToken or implement the getNewUserAccessToken () function, which you can see sample code for in this documentation .
    Permission tokens needed to embed a Power BI app - Power BI | Microsoft Learn
    For those of you who want to host power reports on your own server, our recommendation is that you use the official power bi report server for report management, this program allows you to diversify and direct the management of reports.
    What is Power BI Report Server? - Power BI | Microsoft Learn
    Create a Power BI report for Power BI Report Server - Power BI | Microsoft Learn

    Best regards,

    Albert He

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • Shlokyy's avatar
    Shlokyy
    Regular Visitor

    Yeah, It's right but in the given documentation i have function like this  newAccessToken = await getNewUserAccessToken(reportId, groupId); so in the documentation there is no explaination for getNewUserAccessToken like what to code inside this and if i am assuming that we need to call power bi apis inside this function to get the new accessToken, that means scenario is again go to top, where i need to register for azure Aad and all...! am I right ???

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Shlokyy ,
      Thanks for the reply, according to what the documentation indicates, you can't go and skip registering Azure AD to use the api to refresh the token.
      For more information on how to use the getNewUserAccessToken() function, you can refer to this thread
      Solved: How to implement getNewUserAccessToken() function ... - Microsoft Fabric Community


      Best regards,

      Albert He

       

      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

      • Shlokyy's avatar
        Shlokyy
        Regular Visitor

        can I write a node code to get refresh token from aad