Forum Discussion

Indrasena's avatar
Indrasena
Regular Visitor
4 years ago

Connecting from power BI to rest API with Oath2 authentication

  • Can someone provide a sample power bi project for connecting power Bi to rest API using Oath2 authorisation.

 

7 Replies

  • I was also puzzled that the Web API connector in Power BI still does not support oAuth2.0. I wonder if anyone has developed a custom connector and made available to the public? 

     

    Currently even Google Spreadsheets  third party tools for API ingestion offer support for oAuth 2.0, why not  Power BI? 

     

    I have been googling for 2 days and the status is still the same:

    • For stopping the frustration, Chris Webbs article is still the best ressource.
    • If you have the access token, you can use Power Query to get the data, but (in most cases) you will not be able to request the access token within Power BI.

     

     

  • If you want to publish the report, there is no solution probably at the moment i have the same problem.

    Service provides basic authentication.

    In desktop you can easily in one query make the first call to the login to get the token and then pass the token to the second call as authorization.

     

    body = "{"if it is required for the sign in or you 
                need to put somehow user and pass for sign in"}",
        
    Data= Web.Contents("https://your.sign.in.api",
                                [Content=Text.ToBinary(body),
                                 Headers=[#"Content-Type"="application/json"]]),  
    DataRecord = Json.Document(Data) ,  
    token=DataRecord[data],
        
    Source = Json.Document(Web.Contents("https://your.rest.api", 
                                        [Headers=[#"type"="application_auth",
                                                  #"Authorization"="Bearer "&token]])),
  • Indrasena's avatar
    Indrasena
    Regular Visitor

    Please find the below snippet code and need some inputs for looping,triggering the web api and store each response as record.