Hello everyone,
I'm successfully generating
$authorizationUrl using the code below. However on using that URL I'm receiving the error:
Missing required parameter: scope.
OAUTH2_SCOPE is being declared as a constant in the AdWordsUser class so I'm confused as to why it's not being carried across.
I'm working with the following:
Library: adwords_api_php_4.5.1
Version: v201306
As Always, any ideas would be appreciated.
function GetOAuth2Credential($user, $callbackUrl) {
$redirectUri = $callbackUrl;
$offline = TRUE;
// Get the authorization URL for the OAuth2 token.
// Pass in a redirect URL back to the application,
// Passing true for the second parameter ($offline) will provide us a refresh
// token which can used be refresh the access token when it expires.
$OAuth2Handler = $user->GetOAuth2Handler();
$authorizationUrl = $OAuth2Handler->GetAuthorizationUrl(
$user->GetOAuth2Info(), $redirectUri, $offline);
return $authorizationUrl;
}
// Create a new user and set the oAuth settings
$user = new AdWordsUser();
$user->LogAll();
$user->SetOAuth2Info(array(
"client_id" => $clientId,
"client_secret" => $clientSecret
));
// Generate an authorization URL given the callback URL
$authUrl = GetOAuth2Credential($user, $callbackUrl);