Forum Discussion

ljfoster97's avatar
ljfoster97
Regular Visitor
1 year ago
Solved

OData Feed using basic authentication "We couldn't authenticate with the credentials provided."

We have about a dozen reports that use an OData feed exposing different SQL SmartObjects. Recently, reports have gradually been starting to fail to refresh in the PowerBI Service with the "We coul...
  • v-dineshya's avatar
    1 year ago

    Hi ljfoster97 ,

    Thank you for reaching out to the Microsoft Community Forum.

     

    Please check below solutions.

    1. Credential Scope Reset
    Fully remove all cached credentials: Go to Power BI Desktop → File → Options and Settings → Data Source Settings.
    Remove all entries related to the OData feed (root and full path). Restart Power BI Desktop. When re-connecting, apply Basic Auth credentials at the exact full path level (e.g., https://server/odata/SmartObject.svc/Name) rather than the root URL. Ensure all queries use credentials at this level not at the domain level.

    Then repeat the same in Power BI Service: Go to Settings → Datasets → Data Source Credentials. Delete and re-add credentials using Basic Auth. Ensure privacy level is set to “Organizational” or “None”.

    2. Prevent Credential Inheritance Conflicts
    In the Query Editor, check that each query source is using the exact same scoped level. Avoid mixing different levels  e.g., https://server/odata/ vs https://server/odata/SmartObject.svc/.

    3. Avoid Combine Data Sources
    If you're combining data from multiple SmartObjects or sources, disable the “Fast Combine” option, or restructure to avoid merging unrelated sources. Go to File → Options → Privacy → Ignore privacy levels, if your org policy allows.

    4. Create a Gateway Connection
    If you're refreshing in Power BI Service: Use an on-premises data gateway with Basic Auth configured for OData. Sometimes the Service handles direct-to-web Basic Auth poorly without a gateway.

    5. Monitor Server Logs / K2 Backend
    Check with your admin: Any security or patch updates on the K2 or OData hosting server? Are there any rate limits, IP blocks, or 401 responses logged?

    6. Use Web.Contents with Headers
    As a last resort, try building your query manually using Web.Contents with headers:

    M code

    let
    source = Web.Contents(
    "https://server/odata/SmartObject.svc/Name",
    [
    Headers = [
    #"Authorization" = "Basic " & Binary.ToText(Text.ToBinary("username:password"), BinaryEncoding.Base64)
    ]
    ]
    ),
    data = OData.Feed(source)
    in
    data

    Note: Replace "username:password" with your actual credentials. This can avoid some of the caching/token issues.

     

    Please refer community threads and articles.

    Solved: Get ODATA - We couldn't authenticate with the cred... - Microsoft Fabric Community

    Solved: Cannot authenticate with the credentials provided ... - Microsoft Fabric Community

    Solved: Credentials ODATA feed in Power Bi Online - Microsoft Fabric Community

    Solved: OData credentials not working in Power BI Desktop;... - Microsoft Fabric Community

    Solved: We couldn't authenticate with the credentials prov... - Microsoft Fabric Community

    Power Query OData Feed connector - Power Query | Microsoft Learn

    Client authentication options - Azure DevOps | Microsoft Learn

    We couldn't authenticate with the credentials provided. Please try - Microsoft Community

    Troubleshooting OData sign-in errors in Power BI Desktop - Power BI | Microsoft Learn

    Correct Power BI Connection on Prem

     

    If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

    Thank you

  • Ritaf1983's avatar
    1 year ago

    Hi ljfoster97 

    This sounds like a classic case of inconsistent credential handling between Power BI Desktop and the Service, especially when using Basic Authentication.

    Here are a few things to verify:

    1. Clear cached credentials
    In Power BI Desktop: *File > Options > Data Source Settings*. Locate the OData feed, delete the credentials, and reconnect using Basic Auth. Also make sure the *Privacy Level* is set to "Organizational" or "None", not "Private".

    2. Make sure your PBIX doesn’t reference local files
    Even a single local Excel or CSV file in the model can cause the entire scheduled refresh to fail in the Service, regardless of the main data source.

    3. Check for HTTP redirects or short-lived sessions
    If the OData feed uses redirects (like HTTP 302), the Power BI Service may fail to resend credentials. Similarly, some servers silently expire sessions or throttle repeated requests, which might explain the inconsistent failures.

    4. Try configuring a data gateway
    If the OData source is internal or restricted by IP, routing the refresh through an on-premises data gateway may solve the issue.

    5. Avoid relying on SmartObject behavior
    If you're using K2/Nintex SmartObjects, note that these platforms have known issues when consumed via Power BI, especially around credential persistence and OData versioning.

    6. If none of this helps – open a Microsoft support ticket
    You may be hitting a backend authentication bug in the Service. Microsoft Support can help investigate server-side logs that aren’t accessible otherwise.

    If this post helps, then please consider Accepting it as the solution and giving Kudos to help the other members find it more quickly