Forum Discussion

celsius's avatar
celsius
Regular Visitor
1 year ago
Solved

Connect to API with custom sessionid

Hi, I'm total new in Power BI.   I have a problem which I can't figure out so maybe one of you can assist me.   We have a wepAPI for which we use to support our customers workflow. To give our cu...
  • rohit1991's avatar
    1 year ago

    Hi celsius ,
    To connect Power BI to a web API that requires a session ID for authentication, you need to implement a custom method where Power BI first obtains the session ID upon login and then includes it in the header of every API request

    Since Power BI does not provide a built-in interactive login page for custom authentication, this must be handled using Power Query (M language). The process involves sending login credentials to the API’s authentication endpoint, extracting the session ID from the response, and storing it for subsequent API calls. 

    Every request to fetch data must then include this session ID in the request headers to ensure proper authentication. Additionally, if the session expires periodically, you must implement a way to re-authenticate and refresh the session ID before making new API calls. This method ensures secure access to customer-specific data while leveraging Power BI for reporting and insights. 

    However, since Power BI does not natively support dynamic user authentication per session within a report, this approach is best suited for admin-managed datasets rather than end-user-driven authentication. If necessary, embedding Power BI within your web application using Power BI Embedded may provide a more user-friendly solution for seamless authentication.