Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I am working to integrate PowerBI with a vendor solution/API (Cornerstone) and I have the following code to enter into the Advanced Editor:
let
client_id = "",
client_secret = "",
corporation_host = "",
//do not edit section below
base_url = "https://" & corporation_host & ".csod.com/services/api",
token_url = base_url & "/oauth2/token",
odata_url = base_url & "/x/odata/api/views/",
query = [
clientId = client_id,
clientSecret = client_secret,
grantType = "client_credentials",
scope="all"
],
oauthRequest = Json.FromValue(query),
Response = Web.Contents(token_url, [
Content = oauthRequest,
Headers=[#"Content-type" = "application/json",#"Accept" = "application/json"], ManualStatusHandling = {400}
]
),
Parts = Json.Document(Response),
authToken = if (Record.HasFields(Parts, {"error", "error_description"})) then
error Error.Record(Parts[error], Parts[error_description], Parts)
else
"Bearer " & Parts[access_token],
Source=OData.Feed(odata_url,[#"Authorization" = authToken],null),
//end of do not edit section
User_View = Source{[Name="vw_rpt_user",Signature="table"]}[Data]
in
User_View
I have the correct client secret, ID and site host name, and I am experiencing the following errors:
1) After loading the code into Power Query using the Advanced Editor I get this errror:
2) When I try to configure anonymous access from data source settings - I am returned with the error that "we couldn't authneticate with the credentials provided. Please try again"
Am I missing something in my code or did I misconfigure my OAuth client for my data source? I am trying to access a production government instance if that provides any insight in terms of secruity.
Sorry, no further ideas here.
But often pulling this kind of data via Power Automate into a blob storage first is a good/better alternative.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @Anonymous ,
did you debug parts of your code already?
Like for example if a Token is actually returned?
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi! I am just now re-visiting this and yes - i was able to test via postman and a token is returned. However, still no luck from the PowerBI side. All of the scopes have been turned on the from the Cornerstone (vendor) portal for my service account and I didn't see anything wrong with the config of my OAuth application - I've seen on this forum somebody that was encountering the same issues, but the solution that worked for them (turning on all scopes) did not do the trick for me, I've tried different queries and still no luck populating into PowerBI
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 7 | |
| 7 | |
| 7 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 19 | |
| 14 | |
| 13 | |
| 11 | |
| 9 |