Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Simple API - authenticaion error

Hi
I am struggling to connect to a dataset through API.
A sample PBIX file was provided by the data host however the simple action of switching out the API keys fails connect.

extract here from the advanced editor

let
url = "https://api.workguru.io/api/ClientTokenAuth/Authenticate/api/client/v1/tokenauth",

body = "{ ""ApiKey"": ""YOUR_API_KEY_"", ""Secret"": ""YOUR__API_SECRET"" }",
tokenResponse = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(body) ] )),
AccessToken = tokenResponse[accessToken],
AccessTokenHeader = "Bearer " & AccessToken,


data_url = "https://api.workguru.io/api/services/app/ClientPivotReport/GetAllActivityLinesInPeriod?start=01/01/2...",
data_body = "{
""authorization"": """& AccessTokenHeader & """,
""content-type"": ""application/json""
}",

GetGroups = Json.Document(
Web.Contents(
data_url,
[
Headers = Json.Document(data_body)
]
)
),

categories = GetGroups[result],

#"Converted to Table" = Table.FromList(categories, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"SourceDocNo", "SourceDocName", "Project", "Source", "Quantity", "Item", "UnitCost", "UnitPrice", "Client", "ClientId", "BillingClient", "Code", "Supplier", "Cost", "Revenue", "Profit", "GP", "Document", "ReportingCategory1", "ReportingCategory2", "OwnerOrManager", "CustomFieldValues", "Region", "ProductCategory", "Date", "Year", "Day", "Month", "Qtr"}, {"SourceDocNo", "SourceDocName", "Project", "Source", "Quantity", "Item", "UnitCost", "UnitPrice", "Client", "ClientId", "BillingClient", "Code", "Supplier", "Cost", "Revenue", "Profit", "GP", "Document", "ReportingCategory1", "ReportingCategory2", "OwnerOrManager", "CustomFieldValues", "Region", "ProductCategory", "Date", "Year", "Day", "Month", "Qtr"})
in
#"Expanded Column1"
My ammendment.
body = "{ ""ApiKey"": ""123456789"", ""Secret"": ""123456789"" }",


The error I get is "We couldn't authenticate with the credentials provided. Please try again." but I have confirmed the credentials are correct.

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous 

Please check that.

1.The body of getting access token is right, it may be affected by the token.

2.Please make sure your token is not expired, the token often have one-hour lifetime, if the token is expired, you need to get the token again.

and you can refer to the following link.

Solved: Pull data from a REST API Authentication - Microsoft Fabric Community

 

Best Regards!

Yolo Zhu

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors