Re: OAuth 2.0 hangout and/or screencast please, for PHP Client Library developers
Hi Nick, The UseOAuth2 example has been moved to GetRefreshToken.phphttps://code.google.com/p/google-api-adwords-php/source/browse/examples/AdWords/Auth/GetRefreshToken.php, which demonstrates retrieving and configuring a refresh token (used by OAuth2). For further information on this, please see the OAuth2 wiki pagehttps://code.google.com/p/google-api-adwords-php/wiki/OAuth2 . Currently the PHP has no official support for serviced accounts. The only work around is to use the google-api-php-clienthttp://code.google.com/p/google-api-php-client/to handle the authentication and pass the result to the google-api-adwords-php http://code.google.com/p/google-api-adwords-phplibrary. To request official support for serviced accounts in the PHP client library, please log a feature requesthttps://code.google.com/p/google-api-adwords-php/issues/list . Regards, - Paul, AdWords API Team. On Tuesday, 8 October 2013 19:21:32 UTC+1, Nick Tulip wrote: It looks like the example v201209/Misc/UseOAuth2.php has been removed the lib. Do we know why or if it is even possible anymore to use the PHP Lib with OAuth2 for service accounts? On Tuesday, November 13, 2012 9:50:39 PM UTC-5, Anash P. Oommen wrote: Hi Paul, The AdWords API PHP library already has a code example that shows how to use OAuth2 with AdWords API. You can find it here: http://code.google.com/p/google-api-adwords-php/source/browse/trunk/examples/v201209/Misc/UseOAuth2.php. Also, service accounts allow you to call AdWords API without any user interaction, but that is not the only way to achieve server-to-server call. If you care only about offline call without user interaction and not about impersonating users, then you can use regular OAuth2 call with offline = true as explained here: https://developers.google.com/accounts/docs/OAuth2WebServer#offline. To summarize, 1. You need to get an OAuth2 clientId and secret from https://code.google.com/apis/console. When creating the token, select Installed Application and select Other in the Installed Application type. 2. Substitute these values in UseOAuth2.php example and run it. This code example will generate an access token and refresh token. The access token will expire after an hour, refresh token doesn't. 3. When your access token expires, refresh it using $user-RefreshOAuth2AccessToken call. You could generate a refresh token for your parent MCC once and continue using it without requiring user interaction. Cheers, Anash P. Oommen, AdWords API Advisor. On Tuesday, 13 November 2012 12:59:43 UTC-8, Pianoman wrote: Dear Google Adwords API Team, As you are recommending we start authenticating using OAuth 2.0, could you (Eric Koleda for example) please either organise a hangout and/or create a screencast, explaining how to go about OAuth 2.0 authentication using the PHP Client Library? The only PHP Client Library screencast help I can see online is herehttp://youtube.googleapis.com/v/Idvia4600_E, but that's pretty dated now. I am unfamiliar with OAuth 2.0. For now I am sticking to the deprecated authentication system, but would like to migrate to OAuth 2.0. Regards, -- Paul -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 --- You received this message because you are subscribed to the Google Groups AdWords API Forum group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: OAuth 2.0 hangout and/or screencast please, for PHP Client Library developers
It looks like the example v201209/Misc/UseOAuth2.php has been removed the lib. Do we know why or if it is even possible anymore to use the PHP Lib with OAuth2 for service accounts? On Tuesday, November 13, 2012 9:50:39 PM UTC-5, Anash P. Oommen wrote: Hi Paul, The AdWords API PHP library already has a code example that shows how to use OAuth2 with AdWords API. You can find it here: http://code.google.com/p/google-api-adwords-php/source/browse/trunk/examples/v201209/Misc/UseOAuth2.php. Also, service accounts allow you to call AdWords API without any user interaction, but that is not the only way to achieve server-to-server call. If you care only about offline call without user interaction and not about impersonating users, then you can use regular OAuth2 call with offline = true as explained here: https://developers.google.com/accounts/docs/OAuth2WebServer#offline. To summarize, 1. You need to get an OAuth2 clientId and secret from https://code.google.com/apis/console. When creating the token, select Installed Application and select Other in the Installed Application type. 2. Substitute these values in UseOAuth2.php example and run it. This code example will generate an access token and refresh token. The access token will expire after an hour, refresh token doesn't. 3. When your access token expires, refresh it using $user-RefreshOAuth2AccessToken call. You could generate a refresh token for your parent MCC once and continue using it without requiring user interaction. Cheers, Anash P. Oommen, AdWords API Advisor. On Tuesday, 13 November 2012 12:59:43 UTC-8, Pianoman wrote: Dear Google Adwords API Team, As you are recommending we start authenticating using OAuth 2.0, could you (Eric Koleda for example) please either organise a hangout and/or create a screencast, explaining how to go about OAuth 2.0 authentication using the PHP Client Library? The only PHP Client Library screencast help I can see online is herehttp://youtube.googleapis.com/v/Idvia4600_E, but that's pretty dated now. I am unfamiliar with OAuth 2.0. For now I am sticking to the deprecated authentication system, but would like to migrate to OAuth 2.0. Regards, -- Paul -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 --- You received this message because you are subscribed to the Google Groups AdWords API Forum group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: OAuth 2.0 hangout and/or screencast please, for PHP Client Library developers
Hi Chirag, The simplest way to pass OAuth2 configuration to the AdWordsUser is to use an empty constructor and call the setter -SetOAuth2Info. For an example of this, pelase see the OAuth2 examplehttps://code.google.com/p/google-api-adwords-php/source/browse/trunk/examples/v201209/Misc/UseOAuth2.php . Please bear in mind, that to process the OAuth2 user journey offline, you'll need to first obtain a refresh token online. For more information on this please see the OAuth2 Information https://developers.google.com/accounts/docs/OAuth2WebServer#offlinepage. A quick example of configuring the user could be: $user = new AdWordsUser(); $user-SetOAuth2Info(array( 'client_id' = '8819981768.apps.googleusercontent.com', 'client_secret' = '', )); $authorizationUrl = $user-GetOAuth2AuthorizationUrl(NULL, TRUE); ... Currently the AdWords client library alone doesn't support serviced accounts. Regards, - Paul, 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
Re: OAuth 2.0 hangout and/or screencast please, for PHP Client Library developers
Hello Anash, Yes, I am also looking for that. How i can define Authinfo for any report download. $oauthInfo = array('oauth_consumer_key' = 'consumer_key', 'oauth_consumer_secret' = 'consumer secret', 'oauth_token' = token, 'oauth_token_secret' = token_secret); $user = new AdWordsUser(OAUTH_PATH, NULL, NULL, NULL, NULL, NULL, NULL, OAUTH_SETTINGS_PATH, NULL, $oauthInfo); In Above Example how to define $oauthInfo for oAuth 2.0 use? and which parameter i need to pass? Thanks, Chirag On Thursday, November 15, 2012 5:39:45 AM UTC+5:30, Dale Olson wrote: I am intensely interested in this thread, and it seems to be drifting away from the original question - how to run an adwords adhoc report without user input to authenticate/authorize using OAuth2. Win Ko Aye responded with a very helpful and detailed set of steps to create a service account and create the request, which I followed to the letter but I am still struggling to get working. For the service account approach, I get all the way through creating the token and try to call the service and get back : *com.google.api.ads.common.lib.exception.OAuthException: OAuth2 token could not be refreshed.* *...* *Caused by: com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request { error : invalid_grant }* When looking into what might cause this there are conflicting reports on whether you can even use a service account with the adwords API and the error seems to be saying that I am authenticated but not authorized to use the service. Any ideas here? Anash, regarding your suggestion to create an installed app account this does not seem to satisfy the original request for a way to set up application to application access with no user input required. Please let me know if i misunderstood something here. On Tuesday, November 13, 2012 6:50:39 PM UTC-8, Anash P. Oommen wrote: Hi Paul, The AdWords API PHP library already has a code example that shows how to use OAuth2 with AdWords API. You can find it here: http://code.google.com/p/google-api-adwords-php/source/browse/trunk/examples/v201209/Misc/UseOAuth2.php. Also, service accounts allow you to call AdWords API without any user interaction, but that is not the only way to achieve server-to-server call. If you care only about offline call without user interaction and not about impersonating users, then you can use regular OAuth2 call with offline = true as explained here: https://developers.google.com/accounts/docs/OAuth2WebServer#offline. To summarize, 1. You need to get an OAuth2 clientId and secret from https://code.google.com/apis/console. When creating the token, select Installed Application and select Other in the Installed Application type. 2. Substitute these values in UseOAuth2.php example and run it. This code example will generate an access token and refresh token. The access token will expire after an hour, refresh token doesn't. 3. When your access token expires, refresh it using $user-RefreshOAuth2AccessToken call. You could generate a refresh token for your parent MCC once and continue using it without requiring user interaction. Cheers, Anash P. Oommen, AdWords API Advisor. On Tuesday, 13 November 2012 12:59:43 UTC-8, Pianoman wrote: Dear Google Adwords API Team, As you are recommending we start authenticating using OAuth 2.0, could you (Eric Koleda for example) please either organise a hangout and/or create a screencast, explaining how to go about OAuth 2.0 authentication using the PHP Client Library? The only PHP Client Library screencast help I can see online is herehttp://youtube.googleapis.com/v/Idvia4600_E, but that's pretty dated now. I am unfamiliar with OAuth 2.0. For now I am sticking to the deprecated authentication system, but would like to migrate to OAuth 2.0. Regards, -- Paul -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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: OAuth 2.0 hangout and/or screencast please, for PHP Client Library developers
This is working for me - thank you very much. I'm using Python - example file to use: http://code.google.com/p/google-api-ads-python/source/browse/trunk/examples/adspygoogle/adwords/v201209/misc/use_oauth2.py Do not forget to pass *redirect_uri* argument to the *flow* constructor (use_oauth2.py:49), i.e. redirect_uri='urn:ietf:wg:oauth:2.0:oob' or any other redirect uri from the api console. Remco On Wednesday, 14 November 2012 03:50:39 UTC+1, Anash P. Oommen wrote: Hi Paul, The AdWords API PHP library already has a code example that shows how to use OAuth2 with AdWords API. You can find it here: http://code.google.com/p/google-api-adwords-php/source/browse/trunk/examples/v201209/Misc/UseOAuth2.php. Also, service accounts allow you to call AdWords API without any user interaction, but that is not the only way to achieve server-to-server call. If you care only about offline call without user interaction and not about impersonating users, then you can use regular OAuth2 call with offline = true as explained here: https://developers.google.com/accounts/docs/OAuth2WebServer#offline. To summarize, 1. You need to get an OAuth2 clientId and secret from https://code.google.com/apis/console. When creating the token, select Installed Application and select Other in the Installed Application type. 2. Substitute these values in UseOAuth2.php example and run it. This code example will generate an access token and refresh token. The access token will expire after an hour, refresh token doesn't. 3. When your access token expires, refresh it using $user-RefreshOAuth2AccessToken call. You could generate a refresh token for your parent MCC once and continue using it without requiring user interaction. Cheers, Anash P. Oommen, AdWords API Advisor. -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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: OAuth 2.0 hangout and/or screencast please, for PHP Client Library developers
I am intensely interested in this thread, and it seems to be drifting away from the original question - how to run an adwords adhoc report without user input to authenticate/authorize using OAuth2. Win Ko Aye responded with a very helpful and detailed set of steps to create a service account and create the request, which I followed to the letter but I am still struggling to get working. For the service account approach, I get all the way through creating the token and try to call the service and get back : *com.google.api.ads.common.lib.exception.OAuthException: OAuth2 token could not be refreshed.* *...* *Caused by: com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request { error : invalid_grant }* When looking into what might cause this there are conflicting reports on whether you can even use a service account with the adwords API and the error seems to be saying that I am authenticated but not authorized to use the service. Any ideas here? Anash, regarding your suggestion to create an installed app account this does not seem to satisfy the original request for a way to set up application to application access with no user input required. Please let me know if i misunderstood something here. On Tuesday, November 13, 2012 6:50:39 PM UTC-8, Anash P. Oommen wrote: Hi Paul, The AdWords API PHP library already has a code example that shows how to use OAuth2 with AdWords API. You can find it here: http://code.google.com/p/google-api-adwords-php/source/browse/trunk/examples/v201209/Misc/UseOAuth2.php. Also, service accounts allow you to call AdWords API without any user interaction, but that is not the only way to achieve server-to-server call. If you care only about offline call without user interaction and not about impersonating users, then you can use regular OAuth2 call with offline = true as explained here: https://developers.google.com/accounts/docs/OAuth2WebServer#offline. To summarize, 1. You need to get an OAuth2 clientId and secret from https://code.google.com/apis/console. When creating the token, select Installed Application and select Other in the Installed Application type. 2. Substitute these values in UseOAuth2.php example and run it. This code example will generate an access token and refresh token. The access token will expire after an hour, refresh token doesn't. 3. When your access token expires, refresh it using $user-RefreshOAuth2AccessToken call. You could generate a refresh token for your parent MCC once and continue using it without requiring user interaction. Cheers, Anash P. Oommen, AdWords API Advisor. On Tuesday, 13 November 2012 12:59:43 UTC-8, Pianoman wrote: Dear Google Adwords API Team, As you are recommending we start authenticating using OAuth 2.0, could you (Eric Koleda for example) please either organise a hangout and/or create a screencast, explaining how to go about OAuth 2.0 authentication using the PHP Client Library? The only PHP Client Library screencast help I can see online is herehttp://youtube.googleapis.com/v/Idvia4600_E, but that's pretty dated now. I am unfamiliar with OAuth 2.0. For now I am sticking to the deprecated authentication system, but would like to migrate to OAuth 2.0. Regards, -- Paul -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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