Token by API RRS feed

  • Question

  • Hi,

    We want to grab our BING reports automatically with API yet there is a bottleneck we cannot avoid.

    We have data:

    $UserName = "";
    $Password = "abcabc";
    $DeveloperToken = "0123С4EFG5678900";
    $CustomerId = 876543;
    $AccountId = 123456;

    Also to work with API we need ACCESS_TOKEN. It's valid only 1 hour after it's gotten. And it can be gotten after a human inputs a password in. 
    Is it possible to get a token absolutely automatically and without any human participation? 

    Thank you.

    Tuesday, July 22, 2014 2:31 PM

All replies

  • Hello.

    Which account management model applies to you? For example are you a direct advertiser, agency, or tool provider?

    For a tool provider to authenticate with each application using the Bing Ads API, advertisers must grant your application access to manage their accounts. When the user successfully provides consent, your application is able to obtain an access token that it then used to authenticate against the Microsoft account service on behalf of the user.

    If you are a direct advertiser or agency, you might have a single user who manages all accounts. In that case, and if you have permissions to log in as that user, you can grant the permissions yourself (still through the web UI consent flow).

    Regardless of your account management model the user interface consent is required up front, and thereafter refresh tokens can be used to manage the accounts programmatically. Additional consent may be required if for example the password of the Microsoft account is updated or permissions are otherwise removed.

    For more information, please see Managing User Authentication with OAuth.

    I hope this helps.

    Tuesday, July 22, 2014 5:02 PM
  • Can you provide a sample php code to obtain the authentication token? I have read the Managing User Authentication with OAuth page several times and can't seem to make sense how to do it using php for my app. (My app is a private in-house reporting app for our Bing Ads account).

    I have registered my application, have a client id and client secret, etc.

    (We are direct advertisers, not an agency.)
    • Edited by Keith Sorbo Tuesday, July 22, 2014 9:13 PM clarification
    Tuesday, July 22, 2014 9:02 PM
  • Hello.

    Yes, I will suggest that you start with the PHP OAuth example. Please review and let me know if you have any questions.

    Best regards,

    Thursday, July 24, 2014 2:08 PM