Hey all,I'm trying to implement a new account into the AdSense API application I'm developing, and I'm having issues adding the scope. I've previously added accounts in this way, but when I try to perform the following, I just get an "invalid_scope" responsecurl -d "client_id=123456789.apps.googleusercontent.com&scope=https://www.googleapis.com/auth/adsense.readonly" https://accounts.google.com/o/oauth2/device/codeThe unusual thing is that if I change the scope to something like https://www.googleapis.com/auth/userinfo.email it returns me the device_code, user_code successfully. I've been basing my request on https://developers.google.com/accounts/docs/OAuth2ForDevices and as I mentioned, I've previously authenticated devices in this wayAny help would be very much appreciatedMichael
Hi Sergio,I've tried that as requested, and still get the same "invalid_scope" error response:curl -d "client_id=123456789.apps.googleusercontent.com&scope=https://www.googleapis.com/auth/adsense" https://accounts.google.com/o/oauth2/device/code{"error" : "invalid_scope"}Michael
Just wondering, is there any further insight into this?
On Thursday, 28 June 2012 17:41:38 UTC+1, Michael Ormonde wrote:I've run the curl request with the -v option. If you need anything else, or if this isn't waht you meant, please just let me know:curl -v -d "client_id=123456789.apps.googleusercontent.com&scope=https://www.googleapis.com/auth/adsense.readonly" https://accounts.google.com/o/oauth2/device/code* About to connect() to accounts.google.com port 443* Trying 173.194.78.84... connected* Connected to accounts.google.com (173.194.78.84) port 443* successfully set certificate verify locations:* CAfile: /etc/pki/tls/certs/ca-bundle.crtCApath: none* SSLv2, Client hello (1):SSLv3, TLS handshake, Server hello (2):SSLv3, TLS handshake, CERT (11):SSLv3, TLS handshake, Server finished (14):SSLv3, TLS handshake, Client key exchange (16):SSLv3, TLS change cipher, Client hello (1):SSLv3, TLS handshake, Finished (20):SSLv3, TLS change cipher, Client hello (1):SSLv3, TLS handshake, Finished (20):SSL connection using RC4-SHA* Server certificate:* subject: /C=US/ST=California/L=Mountain View/O=Google Inc/CN=accounts.google.com* start date: 2011-07-21 00:00:00 GMT* expire date: 2013-07-18 23:59:59 GMT* common name: accounts.google.com (matched)* issuer: /C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA* SSL certificate verify ok.> POST /o/oauth2/device/code HTTP/1.1> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5> Host: accounts.google.com> Accept: */*> Content-Length: 104> Content-Type: application/x-www-form-urlencoded>> client_id=123456789.apps.googleusercontent.com&scope=https://www.googleapis.com/auth/adsense.readonlyHTTP/1.1 400 Bad Request< Cache-Control: no-cache, no-store, max-age=0, must-revalidate< Pragma: no-cache< Expires: Fri, 01 Jan 1990 00:00:00 GMT< Date: Thu, 28 Jun 2012 16:38:53 GMT< Content-Type: application/json< X-Content-Type-Options: nosniff< X-Frame-Options: SAMEORIGIN< X-XSS-Protection: 1; mode=block< Server: GSE< Transfer-Encoding: chunked{"error" : "invalid_scope"* Connection #0 to host accounts.google.com left intact* Closing connection #0* SSLv3, TLS alert, Client hello (1):Thanks for all your help with this Sergio :)Michael
This may help too. Looks like similar issue reported for the Tasks API... Unusual as I had used this flow on the AdSense Managemet API before (although that was back in December last year)
https://groups.google.com/forum/?fromgroups#!topic/google-tasks-api/15PxeE89WCoAgain Sergio, I appreciate all the time you're taking to look into this :)Michael
On Thursday, 5 July 2012 10:23:31 UTC+1, Michael Ormonde wrote:Just as an update to this, I tried to submit the post request via a form also to ensure my curl request wasn't at fault. Again, I found that I was getting the "invalid_scope" response. This didn't happen when I substituted the scope for " https://www.googleapis.com/auth/userinfo.email"; when I used that scope, I was able to complete the authorisation process (although obviously that scope isn't useful if I want to access adsense data :)Michael
On Thursday, 5 July 2012 09:57:10 UTC+1, Michael Ormonde wrote:Hey,No worries. I'm currently developing for PHP. My understanding (which I admin is limited on the matter) was that I had to retrieve a device code and get the account to authorize access before the API calls can make the necessary requests as explained in https://developers.google.com/accounts/docs/OAuth2ForDevices. I'll keep digging around and will update here if I figure out what I've been doing wrong. I'll look into the actual library code too and see if there's specific functions for what I'm looking forThanks,Michael