googleads / googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP
Apache License 2.0
655 stars 770 forks source link

Can I run this libary on local machine? #109

Closed ALTELMA closed 8 years ago

ALTELMA commented 8 years ago

I cannot get refresh token, because an error 'uri_redirect_mismatch'. I already create Ouath2. I do something wrong?

Please advice me, please.

fiboknacky commented 8 years ago

Hi Phongthorn,

Have you followed our get started guide? From this post, it's likely that you've not set up client id and secret correctly.

I recommend you to check your settings, especially those written in this section strictly. Also, please ensure you put in valid auth.ini too.

If you need any further help, please let me know.

Knack

ALTELMA commented 8 years ago

I apologized for unclear questions. I will access to DFP and I already from below list.

  1. Already created credentials. I have client_id and client_secret.
  2. Turn on API access in Dfp admin.
  3. Store client_id, client_secret at "googleads-php-lib/src/Google/Api/Ads/Dfp/auth.ini"
  4. I need refresh token, spend 1-2 to research how to get it.
  5. Try to run GetRefreshToken.php in browser, before run I comment this. if (FILE != realpath($_SERVER['PHP_SELF'])) { return; }
  6. I cannot get refresh_token. I get auth_url and run directly see the result "redirect_uri_mismatch" and more detail

"The redirect URI in the request: urn:ietf:wg:oauth:2.0:oob can only be used by a Client ID for native application. It is not allowed for the 'WEB' client type. You can create a Client ID for native application in the Credentials section of the Google Developers Console."

Actually, I so confusing with this line from your instructions. "Now in your distribution, navigate to examples/[PRODUCT]/Auth and run the GetRefreshToken.php example. Copy the refresh token the example produces into the auth.ini file mentioned above."

How can I run GetRefreshToken.php from browser or command line?

Advice or leads me, please. P.S. use PHP Thank you.

vtsao commented 8 years ago

The error is pretty clear, you'll need to create a client ID and secret of type "installed application" on the Google Developer console (it may also be called "other").

You must run the GetRefreshToken.php example in a command line, it will not work in the browser.

Thanks, Vincent

Editea commented 5 years ago

The error is pretty clear, you'll need to create a client ID and secret of type "installed application" on the Google Developer console (it may also be called "other").

You must run the GetRefreshToken.php example in a command line, it will not work in the browser.

Thanks, Vincent

Wow, at first I didn't found that "installed application" type, but then you said it can called "other" and you just saved my life. Thanks!!!