Search code examples
google-apps-scriptoauth-2.0bingbing-ads-api

Bing Ads API v2 oAuth2


I have a Google Appsscript code using oAuth2 to connect to Bing Ads API.

It goes like:

OAuth2.createService(connector.OAUTH.serviceName)
    .setAuthorizationBaseUrl(connector.OAUTH.authorizationURL)
    .setTokenUrl(connector.OAUTH.tokenURL)
    .setClientId(connector.OAUTH.clientId)
    .setClientSecret(connector.OAUTH.clientSecret)
    .setPropertyStore(PropertiesService.getUserProperties())
    .setScope('bingads.manage')
    .setCallbackFunction('authCallback');

If I use one of my old bing dev applications (I believe API v1), oAuth2 works fine, however, when I use a newly created application (and add the callback URL), I am getting unauthorized_client error.

I couldn't find a change reference between the versions, so not sure what I am doing wrong

This is how my old app is set up: enter image description here


Solution

  • Apparently, my application was somehow flawed. Instead of changing the code, I recreated the application, and it now works.