Note: These steps were tested as of June 3rd, 2021, you may need modify these steps to work for your specific project.
This uses the BingAds-PHP-SDK for the Bing Ads API
You need access before you can use the API, follow the links below to help you gain access.
Help Guide - Get a Developer Token
Bing Requires you to register your app. This is where you get your client id and client secret.
-
Supported account types: select "Accounts in any organizational directory (Any Azure AD directory - Multitenant)"
-
Redirect URI: Web type, then add
https://login.microsoftonline.com/common/oauth2/nativeclient
-
Fill in .env
BING_CLIENT_ID
with the "Application (client) ID" from the overview page for your app -
Go to Certificates & secrets and create a new secret
-
Copy the "value" of this new secret into the .env
BING_CLIENT_SECRET
(not the secret ID)
Run php artisan laravelads:token:generate --service=BingAds
-
Copy and go to the URL shown after running that command
-
It will ask you to login and "approve access" to your application
-
You will be redirected to a URL, most likely a white page. COPY the url from in the address bar and paste it into the command line.
-
Copy and paste the refresh token you see into .env
BING_REFRESH_TOKEN
The Bing Ads API Sandbox can be used by changing the API environment using the ->setEnvironment('Sandbox')
method.