Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
I have gone through salesforce help and they believe the issue is on the power bi side so checking here.
I have an external client app set up to api connect salesforce to power bi. this is the code i'm using
its giving me a DataSource.Error: Web.Contents failed to get contents from 'https://caterpillar.my.salesforce.com/services/oauth2/token' Bad Request error.
Am I missing something?
let
// 1. Define Salesforce API credentials
SalesforceUrl = "https://*Client*.my.salesforce.com",
ClientId = "ClientKey",
ClientSecret = "clientsecret",
// 2. Request the OAuth2 Access Token
TokenResponse = Json.Document(Web.Contents(SalesforceUrl & "/services/oauth2/token", [
Content = Text.ToBinary("grant_type=client_credentials&client_id=" & ClientId & "&client_secret=" & ClientSecret),
Headers = [#"Content-Type"="application/x-www-form-urlencoded"]
])),
AccessToken = TokenResponse[access_token],
// 3. Query the data using REST API (SOQL)
DataResponse = Json.Document(Web.Contents(SalesforceUrl & "/services/data/v60.0/query", [
Query = [q="SELECT Id, Name, Email FROM User WHERE Profile.Name = 'System Administrator'"],
Headers = [#"Authorization" = "Bearer " & AccessToken]
])),
// 4. Parse the results into a table
Records = DataResponse[records],
Table = Table.FromList(Records, Record.FieldValues, {"Id", "Name", "Email"})
in
Table
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Check out the July 2026 Power BI update to learn about new features.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 30 | |
| 25 | |
| 25 | |
| 25 | |
| 16 |
| User | Count |
|---|---|
| 53 | |
| 31 | |
| 26 | |
| 23 | |
| 20 |