guelug / google-api-adwords-php

Automatically exported from code.google.com/p/google-api-adwords-php
Apache License 2.0
0 stars 0 forks source link

Bug error api #111

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
erro: Your OAuth2 Credentials are incorrect. Please see the GetRefreshToken.php 
example. { "error" : "invalid_request" }

I do not know how to solve

Original issue reported on code.google.com by l...@seolink.com.br on 3 Oct 2013 at 6:17

GoogleCodeExporter commented 8 years ago
I'm using

try
{
    // Get the client ID and secret from the auth.ini file. If you do not have a
    // client ID or secret, please create one of type "installed application" in
    // the Google API console: https://code.google.com/apis/console#access
    // and set it in the auth.ini file.
    $user = new AdWordsUser(NULL, $email, $password, $developerToken, $applicationToken, $userAgent, $clientId);
    $user->SetDefaultServer("https://adwords.google.com");
    $user->LogAll();
    $user->SetClientId($clientId);

    // Get the OAuth2 credential.
    $oauth2Info = GetOAuth2Credential($user);

    // Enter the refresh token into your auth.ini file.
    printf("Your refresh token is: %s\n\n", $oauth2Info['refresh_token']);
    printf("In your auth.ini file, edit the refresh_token line to be:\n");
    printf("refresh_token = \"%s\"\n", $oauth2Info['refresh_token']);

}
catch (OAuth2Exception $e)
{
  ExampleUtils::CheckForOAuth2Errors($e);
}

Original comment by l...@seolink.com.br on 3 Oct 2013 at 6:18

GoogleCodeExporter commented 8 years ago
Hi there,

You don't appear to be configuring the AdWordsUser with OAuth2 credentials.

For information on how to configure your account, please see the new OAuth2 
migration video:
http://www.youtube.com/watch?v=KetKPhxY4Js

You can also find the information in the OAuth2 migration guide:
https://code.google.com/p/google-api-adwords-php/wiki/OAuth2

Regards,

- Paul, AdWords API Team.

Original comment by api.pmat...@gmail.com on 4 Oct 2013 at 1:30