1313use Microsoft \BingAds \Auth \AuthorizationData ;
1414use Microsoft \BingAds \Auth \OAuthTokenRequestException ;
1515use Microsoft \BingAds \Auth \ApiEnvironment ;
16+ use Microsoft \BingAds \Auth \OAuthScope ;
1617use Microsoft \BingAds \Auth \ServiceClient ;
1718use Microsoft \BingAds \Auth \ServiceClientType ;
1819
@@ -43,19 +44,20 @@ final class AuthHelper {
4344
4445 const DeveloperToken = 'BBD37VB98 ' ; // For sandbox use BBD37VB98
4546 const ApiEnvironment = ApiEnvironment::Sandbox;
47+ const OAuthScope = OAuthScope::MSADS_MANAGE ;
4648 const OAuthRefreshTokenPath = 'refresh.txt ' ;
47- const ClientId = 'db41b09d-6e50-4f4a-90ac-5a99caefb52f ' ; // For sandbox use db41b09d-6e50-4f4a-90ac-5a99caefb52f
49+ const ClientId = '4c0b021c-00c3-4508-838f-d3127e8167ff ' ; // For sandbox use 4c0b021c-00c3-4508-838f-d3127e8167ff
4850
4951 const CampaignTypes =
5052 CampaignType::Audience . ' ' .
5153 CampaignType::Search . ' ' .
52- CampaignType::Shopping . ' ' .
53- CampaignType::DynamicSearchAds;
54+ CampaignType::Shopping;
5455
5556 const CampaignAdditionalFields =
5657 CampaignAdditionalField::AdScheduleUseSearcherTimeZone . ' ' .
5758 CampaignAdditionalField::MaxConversionValueBiddingScheme . ' ' .
58- CampaignAdditionalField::TargetImpressionShareBiddingScheme;
59+ CampaignAdditionalField::TargetImpressionShareBiddingScheme . ' ' .
60+ CampaignAdditionalField::TargetSetting;
5961
6062 const AllTargetCampaignCriterionTypes =
6163 CampaignCriterionType::Age . ' ' .
@@ -77,10 +79,6 @@ final class AuthHelper {
7779
7880 static function Authenticate ()
7981 {
80- // Disable WSDL caching.
81- ini_set ("soap.wsdl_cache_enabled " , "0 " );
82- ini_set ("soap.wsdl_cache_ttl " , "0 " );
83-
8482 // Authenticate with a Microsoft Account.
8583 AuthHelper::AuthenticateWithOAuth ();
8684
@@ -170,7 +168,8 @@ static function AuthenticateWithOAuth()
170168 {
171169 $ authentication = (new OAuthDesktopMobileAuthCodeGrant ())
172170 ->withEnvironment (AuthHelper::ApiEnvironment)
173- ->withClientId (AuthHelper::ClientId);
171+ ->withClientId (AuthHelper::ClientId)
172+ ->withOAuthScope (AuthHelper::OAuthScope);
174173
175174 $ GLOBALS ['AuthorizationData ' ] = (new AuthorizationData ())
176175 ->withAuthentication ($ authentication )
0 commit comments