UseOAuth in the Example of PHP SDK
Hi! So I finally got the examples to run! I am trying to get OAuth to work with PHP and Google Adwords API, so far I wasn't able to even run this UseOAuth.php script because I didn't have the oauth.so extension included in my PHP installation. But now I've fixed that and I have gotten this far: php UseOAuth.php Log in to your AdWords account and open the following URL: https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=4%ON After approving the token enter the verification code here: -Dxn Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect) I have edited out my verification code and request token :) How come this isn't working? I have tried manually editing the script to include my verification code, but it still didn't work. I have read the README and it appears that I need to enter my credentials into auth.ini I found the auth.ini file and it says this: ;email = "INSERT_EMAIL_ADDRESS_HERE" ;password = "INSERT_PASSWORD_HERE" ;userAgent = "INSERT_COMPANY_NAME_HERE" ;applicationToken = "INSERT_APPLICATION_TOKEN_HERE" ;developerToken = "INSERT_DEVELOPER_TOKEN_HERE" ; Uncomment to make requests against a client account. ; clientId = "INSERT_CLIENT_EMAIL_OR_CUSTOMER_ID_HERE" ; Uncomment the following to use an existing AuthToken. ;authToken = "INSERT_AUTH_TOKEN" ; Uncomment the following to use existing OAuth information. ; [OAUTH] ; oauth_consumer_key = "INSERT_OAUTH_CONSUMER_KEY_HERE" ; oauth_consumer_secret = "INSERT_OAUTH_CONSUMER_SECRET_HERE" ; oauth_token = "INSERT_OAUTH_TOKEN_HERE" ; oauth_token_secret = "INSERT_OAUTH_TOKEN_SECRET_HERE" So I have read that I do not need to supply an application token any more. My developer token is "Pending Approval" via MCC, but I was told I could use my email++USD to use the sandbox version of the API. So I tried putting that under developerToken, but the php script resulted in the same Invalid/bad ... error. I have edited my settings.ini to use the sandbox api uri: DEFAULT_SERVER = "https://adwords-sandbox.google.com"; But still no luck! What am I doing wrong here? Do I need to acquire my OAuth information? How do I get my consumer key and consumer secret? By the way I have tried to use my email and password, but it didn't work either, Please help! Any advice would be a huge help, Thank you !!! :) -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
Hi, You can use "anonymous" as your consumer_key and consumer_secret for testing against sandbox or you can apply for getting both by following the instructions here http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html Best, -David Torres - AdWords API Team On Jun 16, 5:43 pm, Doug wrote: > Hi! So I finally got the examples to run! I am trying to get OAuth to work > with PHP and Google Adwords API, so far I wasn't able to even run this > UseOAuth.php script because I didn't have the oauth.so extension included in > my PHP installation. But now I've fixed that and I have gotten this far: > > php UseOAuth.php > Log in to your AdWords account and open the following > URL:https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=4%ON > After approving the token enter the verification code here: -Dxn > Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect) > > I have edited out my verification code and request token :) > > How come this isn't working? I have tried manually editing the script to > include my verification code, but it still didn't work. I have read the > README and it appears that I need to enter my credentials into auth.ini > > I found the auth.ini file and it says this: > > ;email = "INSERT_EMAIL_ADDRESS_HERE" > ;password = "INSERT_PASSWORD_HERE" > ;userAgent = "INSERT_COMPANY_NAME_HERE" > ;applicationToken = "INSERT_APPLICATION_TOKEN_HERE" > ;developerToken = "INSERT_DEVELOPER_TOKEN_HERE" > > ; Uncomment to make requests against a client account. > ; clientId = "INSERT_CLIENT_EMAIL_OR_CUSTOMER_ID_HERE" > > ; Uncomment the following to use an existing AuthToken. > ;authToken = "INSERT_AUTH_TOKEN" > > ; Uncomment the following to use existing OAuth information. > ; [OAUTH] > ; oauth_consumer_key = "INSERT_OAUTH_CONSUMER_KEY_HERE" > ; oauth_consumer_secret = "INSERT_OAUTH_CONSUMER_SECRET_HERE" > ; oauth_token = "INSERT_OAUTH_TOKEN_HERE" > ; oauth_token_secret = "INSERT_OAUTH_TOKEN_SECRET_HERE" > > So I have read that I do not need to supply an application token any more. > My developer token is "Pending Approval" via MCC, but I was told I could use > my email++USD to use the sandbox version of the API. So I tried putting that > under developerToken, but the php script resulted in the same Invalid/bad > ... error. > > I have edited my settings.ini to use the sandbox api uri: > > DEFAULT_SERVER = "https://adwords-sandbox.google.com"; > > But still no luck! What am I doing wrong here? Do I need to acquire my OAuth > information? How do I get my consumer key and consumer secret? By the way I > have tried to use my email and password, but it didn't work either, > > Please help! Any advice would be a huge help, Thank you !!! :) -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
Hi, You can use "anonymous" as consumer key and secret for testing against sandbox and then apply here http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html for using it in production. Best, -David Torres - AdWords API Team On Jun 16, 5:43 pm, Doug wrote: > Hi! So I finally got the examples to run! I am trying to get OAuth to work > with PHP and Google Adwords API, so far I wasn't able to even run this > UseOAuth.php script because I didn't have the oauth.so extension included in > my PHP installation. But now I've fixed that and I have gotten this far: > > php UseOAuth.php > Log in to your AdWords account and open the following > URL:https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=4%ON > After approving the token enter the verification code here: -Dxn > Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect) > > I have edited out my verification code and request token :) > > How come this isn't working? I have tried manually editing the script to > include my verification code, but it still didn't work. I have read the > README and it appears that I need to enter my credentials into auth.ini > > I found the auth.ini file and it says this: > > ;email = "INSERT_EMAIL_ADDRESS_HERE" > ;password = "INSERT_PASSWORD_HERE" > ;userAgent = "INSERT_COMPANY_NAME_HERE" > ;applicationToken = "INSERT_APPLICATION_TOKEN_HERE" > ;developerToken = "INSERT_DEVELOPER_TOKEN_HERE" > > ; Uncomment to make requests against a client account. > ; clientId = "INSERT_CLIENT_EMAIL_OR_CUSTOMER_ID_HERE" > > ; Uncomment the following to use an existing AuthToken. > ;authToken = "INSERT_AUTH_TOKEN" > > ; Uncomment the following to use existing OAuth information. > ; [OAUTH] > ; oauth_consumer_key = "INSERT_OAUTH_CONSUMER_KEY_HERE" > ; oauth_consumer_secret = "INSERT_OAUTH_CONSUMER_SECRET_HERE" > ; oauth_token = "INSERT_OAUTH_TOKEN_HERE" > ; oauth_token_secret = "INSERT_OAUTH_TOKEN_SECRET_HERE" > > So I have read that I do not need to supply an application token any more. > My developer token is "Pending Approval" via MCC, but I was told I could use > my email++USD to use the sandbox version of the API. So I tried putting that > under developerToken, but the php script resulted in the same Invalid/bad > ... error. > > I have edited my settings.ini to use the sandbox api uri: > > DEFAULT_SERVER = "https://adwords-sandbox.google.com"; > > But still no luck! What am I doing wrong here? Do I need to acquire my OAuth > information? How do I get my consumer key and consumer secret? By the way I > have tried to use my email and password, but it didn't work either, > > Please help! Any advice would be a huge help, Thank you !!! :) -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
Excellent thank you David! -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
Thank you! So what do I need to provide out of the auth.ini file? Other than the obvious Oauth entries :) email = "do...m" password = "p...9" ;userAgent = "INSERT_COMPANY_NAME_HERE" ;applicationToken = "INSERT_APPLICATION_TOKEN_HERE" developerToken = "do...D" ; Uncomment to make requests against a client account. clientId = "cli...m" ; Uncomment the following to use an existing AuthToken. ;authToken = "do..D" ; Uncomment the following to use existing OAuth information. ; [OAUTH] ; oauth_consumer_key = "INSERT_OAUTH_CONSUMER_KEY_HERE" ; oauth_consumer_secret = "INSERT_OAUTH_CONSUMER_SECRET_HERE" ; oauth_token = "INSERT_OAUTH_TOKEN_HERE" ; oauth_token_secret = "INSERT_OAUTH_TOKEN_SECRET_HERE" -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
If possible I would still like to know which of these do I need if I'm strictly using OAuth, Like do I need a clientId? If so, where can I get it? I have been using the sandbox clientID (clientid_1+em...@email.com) I imagine I can leave AuthToken commented correct? And the developer token I have now; its been approved in my MCC, The email and password I'm guessing I Don't need if I supply a oauth token and oauth token secret correct? Thank you! -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
Hi Doug, You should comment out: - email and password since your are using OAuth - authToken is specific to ClientLogin which is another way to authenticate so it is either this or OAuth. - applicationToken is not longer required by the API - clientId you need to use if you authorized your MCC account via OAuth so you need clientId to specify which of the AdWords accounts that the MCC manages you are accessing. ClientId can be an account id or the email address associated to the account. Best, -David -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
Hi dave when I comment out email and password I get this error: Validation failed for [email] with value []: email is required and cannot be NULL.null -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
Hi Doug, You can tryout sample webapp. There they have used oauth for verification. http://code.google.com/p/google-api-adwords-php/source/browse/apps/sample-webapp/public/login.php You need to persist the OAuth token and token secret between requests, for instance in the PHP session. On Aug 5, 10:11 am, Doug wrote: > Hi dave when I comment out email and password I get this error: > > Validation failed for [email] with value []: email is required and cannot be > NULL.null -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
Hi Chirag! Thank you for your suggestion, I am indeed storing them in a PHP session, and I've got that part working, I get a response that reads OAuth Authentication Successful So then I store the tokens, but when I instantiate an AdwordsUser object I get this: Validation failed for [email] with value []: email is required and cannot be NULL.null It looks like the auth.ini inside the example app doesn't have an email address sent with it, just a developer token. Why do I need to provide the email if I'm using OAuth? Thanks! -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
Re: UseOAuth in the Example of PHP SDK
Hi Doug, If you call $user->SetOAuthInfo() before you create a service the library shouldn't require a password. Best, - Eric Koleda, AdWords API Team -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en