MicrosoftDocs / Advertising-docs

Creative Commons Attribution 4.0 International
15 stars 59 forks source link

Authentication failed on AddCampaigns #1051

Closed pijussau closed 3 years ago

pijussau commented 3 years ago

Hello,

I been trying for a lot of hours now with every possible customerId and accountId variation and I am pretty certain I have sent the right authentication but somehow I am just getting the same error message which is Authentication failed. Either supplied credentials are invalid or the account is inactive.

When I am on campaigns in one of my accounts the url is:

https://ui.ads.microsoft.com/campaign/vnext/overview?aid=150489161&ccuisrc=4&cid=250253143&uid=107139523

I am sending this request:

<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
        <s:Header xmlns="https://bingads.microsoft.com/Customer/v13">
          <Action mustUnderstand="1">AddCampaigns</Action>
          <AuthenticationToken i:nil="false">123</AuthenticationToken>
          <DeveloperToken i:nil="false">11957P0037216643</DeveloperToken>
          <CustomerAccountId i:nil="false">250253143</CustomerAccountId>
          <CustomerId i:nil="false">150489161</CustomerId>
        </s:Header>
        <s:Body>
          <AddCampaignsRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v13">
          <AccountId>250253143</AccountId>
          <Campaigns i:nil="false">
            <Campaign>
              <BiddingScheme i:nil="false" i:type="-- derived type specified here with the appropriate prefix --">
                <Type i:nil="false">ManualCpcBiddingScheme</Type>
                <!--This field is applicable if the derived type attribute is set to MaxClicksBiddingScheme-->
                <MaxCpc i:nil="false">
                  <Amount i:nil="false">5</Amount>
                </MaxCpc>
              </BiddingScheme>
              <BudgetType i:nil="false">DailyBudgetStandard</BudgetType>
              <DailyBudget i:nil="false">500</DailyBudget>
              <Name i:nil="false">adtravis_123_2021-08-27-08:26</Name>
              <Status i:nil="false">Active</Status>
            </Campaign>
          </Campaigns>
        </AddCampaignsRequest>
        </s:Body>
      </s:Envelope><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>s:Server</faultcode><faultstring xml:lang="en-US">Invalid client data. Check the SOAP fault details for more information. TrackingId: fc73fd4e-6da6-4746-9f5b-0c39527e79f3.</faultstring><detail><AdApiFaultDetail xmlns="https://adapi.microsoft.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><TrackingId>fc73fd4e-6da6-4746-9f5b-0c39527e79f3</TrackingId><Errors><AdApiError><Code>105</Code><Detail i:nil="true"/><ErrorCode>InvalidCredentials</ErrorCode><Message>Authentication failed. Either supplied credentials are invalid or the account is inactive</Message></AdApiError></Errors></AdApiFaultDetail></detail></s:Fault></s:Body></s:Envelope>

Can someone please tell me what is wrong here?

pijussau commented 3 years ago

Looks there was something wrong with my request instead, so seems to be OK now

eric-urban commented 3 years ago

@pijussau - Please double check are you using the production endpoint or sandbox? If you use production credentials w/ sandbox endpoint the 105 error is expected.

Separately you need to specify the bidding scheme type. Replace this:

<BiddingScheme i:nil="false" i:type="-- derived type specified here with the appropriate prefix --">

With something like this:

<BiddingScheme i:nil="false" i:type=ManualCpcBiddingScheme">

Does this help resolve the issue?

pijussau commented 3 years ago

The problem was not exactly BiddingScheme, but I was missing other fields in the request apparently it gave the 105 error