简体   繁体   中英

In Google adwords API Trying to execute the GetKeywordIdeas.php but unsuccessful using Test Accounts

I have been trying to execute the GetKeywordIdeas.php using Test accounts. But when I try to execute the file it gives error and returns "An error has occurred: { "error" : "invalid_client" }

These are the details used in \\src\\Google\\Api\\Ads\\AdWords\\auth.ini file

developerToken = "APPROVAL PENDING TOKEN FROM GOOGLE ADWORDS API" userAgent = "MY COMPANY NAME"

client_id = "ID GENERATE USING GOOGLE CONSOLE WITH THE MCC account EMAIL ID" client_secret = "SECRET GENERATE USING GOOGLE CONSOLE WITH THE MCC account EMAIL ID"

Also when I run the GetRefreshToken.php , I get this error:

Log in to your AdWords account and open the following URL: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=ID GENERATE USING GOOGLE CONSOLE WITH THE MCC account EMAIL ID&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fadwords.google.com%2Fapi%2Fadwords%2F&access_type=offline After approving the token enter the authorization code here: Your OAuth2 Credentials are incorrect. Please see the GetRefreshToken.php example. { "error" : "invalid_request" }

On executing this url it says Error: redirect_uri_mismatch

Not sure what is going wrong here. Since it says 'Your OAuth2 Credentials are incorrect.' does it mean the credentials are not correctly generated?

Kind regards,

Mithila

After clicking the link you should get the token. You may probably didnt copy & paste the following url properly

https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=ID GENERATE USING GOOGLE CONSOLE WITH THE MCC account EMAIL ID&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fadwords.google.com%2Fapi%2Fadwords%2F&access_type=offline

You redirect uri is not matching with your google Oauth Application.

use same redirect url in GetRefreshToken.php file which you used while creating New clientid.

You can create client application from this url.

https://console.developers.google.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM