[Reporting API v13] Error 105 (InvalidCredentials) when using OAuth 2.0 client credentials (daemon / server-to-server)

felipy c 0 Reputation points
2025-10-14T19:21:36.9133333+00:00

[Reporting API v13] Error 105 (InvalidCredentials) when using OAuth 2.0 client credentials (daemon / server-to-server)

Summary

I’m building a server-to-server (daemon / machine-to-machine) integration to pull Microsoft Advertising reports via REST (Reporting API v13).
I can obtain an access token using OAuth 2.0 client credentials, but when I call GenerateReport/Submit I get the following error:

{ "Errors": [ { "Code": 105, "Message": "Authentication failed. Either supplied credentials are invalid or the account is inactive", "Detail": null, "ErrorCode": "InvalidCredentials" } ], "TrackingId": "fc4bb6a6-3797-4605-b640-6daec5cba888", "Type": "AdApiFaultDetail" }

I would like to confirm whether client_credentials is supported for Microsoft Advertising APIs, and if so, what configuration I may be missing.


Environment

  • Goal: daily Ad Performance (impressions, clicks, cost) for data ingestion
  • API: Reporting API v13
  • Report endpoint environment: sandbox
  • Flow: daemon (no interactive user)
  • Headers: Authorization, DeveloperToken, CustomerId (CID), CustomerAccountId (AID)

(IDs and secrets below are masked.)


Authentication (token) — client credentials

Token endpoint: POST https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token

Request body (x-www-form-urlencoded): client_id=XXX client_secret=XXX grant_type=client_credentials scope=https://ads.microsoft.com/.default

Response (truncated): { "token_type": "Bearer", "expires_in": 3599, "ext_expires_in": 3599, "access_token": "eyJhbGciOiJkaXIiLCJlbmMiOi ..." }


Report call — GenerateReport/Submit (sandbox)

Endpoint: POST https://reporting.api.sandbox.bingads.microsoft.com/Reporting/v13/GenerateReport/Submit

Headers: Authorization: Bearer {ACCESS_TOKEN} DeveloperToken: BBD37VB98 CustomerId: XXX CustomerAccountId: XXX Content-Type: application/json

Body (JSON): { "ReportRequest": { "Type": "AdPerformanceReportRequest", "ReportName": "XXX Ad Perf (7d)", "Format": "Csv", "FormatVersion": "2.0", "ReturnOnlyCompleteData": false, "Aggregation": "Daily", "Columns": [ "TimePeriod", "CampaignId", "CampaignName", "AdId", "Title", "Impressions", "Clicks", "Spend" ], "Scope": { "AccountIds": [XXXX] }, "Time": { "CustomDateRangeStart": { "Year": 2025, "Month": 10, "Day": 6 }, "CustomDateRangeEnd": { "Year": 2025, "Month": 10, "Day": 12 }, "ReportTimeZone": "SaoPaulo" } } }

Response: { "Errors": [ { "Code": 105, "Message": "Authentication failed. Either supplied credentials are invalid or the account is inactive", "Detail": null, "ErrorCode": "InvalidCredentials" } ], "TrackingId": "fc4bb6a6-3797-4605-b640-6daec5cba888", "Type": "AdApiFaultDetail" }


What I have already checked

  • Authorization: Bearer {access_token} is present
  • DeveloperToken, CustomerId (CID), and CustomerAccountId (AID) are included
  • ✅ Report body is valid (includes TimePeriod for daily aggregation)
  • ✅ Tried different resource/scope formats for the token (still failing)
  • Environment: I’m calling sandbox — do I need sandbox-specific CID/AID (distinct from production)?
  • Scopes/permissions: Is the msads.manage (delegated) scope required even for Reporting?
  • Client credentials support: Does the Advertising API accept application permissions (app-only) for Reporting?
  • Account status/access: Could this be caused by an inactive account or a user that lacks access to the specified CID/AID?

Specific questions for Microsoft / community

  1. Does the Microsoft Advertising API (Reporting v13) support the OAuth 2.0 client_credentials flow (app-only)?
    • If yes, what is the correct resource/scope and the prerequisites (app permissions, admin consent, etc.)?
    • If no, what is the recommended flow for daemon scenarios? (e.g., authorization_code + offline_access, then use the refresh_token on a schedule)
  2. Are there credential differences between production and sandbox (e.g., CID/AID and DeveloperToken) that could cause Code 105 when using a valid token?
  3. Does the DeveloperToken need to be explicitly enabled for sandbox (or linked to a sandbox user) to avoid this error?
  4. How can I diagnose whether the token issued via client_credentials includes the claims/audience required for Microsoft Advertising?
    • Is there a specific aud expected in the JWT?
  5. If client_credentials is not supported, could you please confirm officially that only user-delegated flows (e.g., authorization_code with msads.manage) are accepted for Reporting?

References


Thanks!

Any official confirmation on client_credentials support for Advertising and guidance on sandbox vs. production prerequisites would be greatly appreciated.

Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
{count} votes

1 answer

Sort by: Most helpful
  1. MS Advertising - John Mark 150 Reputation points Microsoft External Staff Moderator
    2025-10-14T22:58:19.35+00:00

    Hi Felipy c,

    Thank you for reaching out to the Microsoft Advertising Learn Q&A Platform!

    It looks like you're running into the "Error 105 (InvalidCredentials)" while trying to pull Microsoft Advertising reports using OAuth 2.0 client credentials on the sandbox environment

    When you see the error:

    "Code": 105,
    "Message": "Authentication failed. Either supplied credentials are invalid or the account is inactive",
    "ErrorCode": "InvalidCredentials"

    In the sandbox environment, it almost always boils down to one of two root causes:

    1. Sandbox-Specific Credentials Mismatch DeveloperToken • Must be explicitly approved for sandbox use (production tokens won’t work).

    CustomerId (CID) & CustomerAccountId (AID) • Sandbox has its own set of CIDs/AIDs—production IDs will be rejected.

    Account Activation • Ensure your sandbox account is active and that the user who granted consent actually has access to those sandbox IDs.

    1. Unsupported Client Credentials Flow The Reporting v13 REST endpoints do not accept the OAuth 2.0 client_credentials grant.

    These APIs require a user context, so you must use the authorization_code flow with the offline_access scope.

    Interactive sign-in once will yield a refresh token; exchange that for new access tokens on your schedule.

    Client Credentials Flow Support Client credentials (app-only) are not supported for Microsoft Advertising Reporting v13. These endpoints require a user context obtained via a delegated flow. Code 105 often indicates an invalid or missing user credential. Handling Service Errors and Exceptions

    Sandbox vs. Production Credentials Customer IDs (CID/AID) and DeveloperTokens are environment-specific. Sandbox accounts require a DeveloperToken explicitly enabled for sandbox use. Mixing production tokens with sandbox IDs will trigger Error 105 (InvalidCredentials)

    More information on these resources: Microsoft Advertising Sandbox Bing Ads API Web Service Addresses

    I hope the information provided here will at least partly answer your question. For us to make sure that we are able to address the issue, I'll be sending a private message on your inbox, please check your private message for further assistance.

    Our support teams are happy to discuss your account in more detail via phone, chat or email to provide review assistance, please see our support page to reach out!

    Kind regards,

    John | Microsoft Advertising Support Specialist | 1-800-518-5689


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.