Re: AdSense Reports using OAUTH 1.0

57 views
Skip to first unread message

Sérgio Gomes

unread,
Jun 14, 2012, 7:12:37 AM6/14/12
to adsen...@googlegroups.com
Hi Dor,

Could you provide some more details on the error you're getting when attempting the request?

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


---
On Wednesday, 13 June 2012 14:55:17 UTC+1, Dor Ben Dov wrote:

I have tried this link below according to Google instructions with a key at the end that I produced using the account we have on Google.

Protocol OAUTH 1.0 with the key but nothing works it doesn’t works.

What can be the problem ?

https://www.googleapis.com/adsense/v1.1/reports?startDate=2012-06-01&endDate=2012-06-10&dimension=DATE&dimension=AD_UNIT_CODE&metric=PAGE_VIEWS&metric=AD_REQUESTS&metric=CLICKS&metric=EARNINGS&sort=DATE&pp=1&key=mykey

Anyone ? 


Thanks in advanced to all,

Dor

Sérgio Gomes

unread,
Jun 18, 2012, 6:52:23 AM6/18/12
to adsen...@googlegroups.com
Hi Dor,

So, first of all, I would like to recommend you use one of our client libraries instead of coding from scratch, as they help out with a lot of things (including authentication), making your life a lot easier. We also have code examples for several of them. Failing that, it may be a good idea to at least use OAuth 2.0, as OAuth 1.0 is deprecated for the AdSense Management API.

Having said all that, the problem seems to be that you're not performing authentication correctly. Authentication data should be passed as part of the HTTP request, and what the service is complaining about is that this data hasn't been provided. Also, the AdSense Management API does't support "simple key access", which seems to be what you're using, since it accesses sensitive user data. Here's the OAuth 1.0 documentation for web-based applications: https://developers.google.com/accounts/docs/OAuth

Hope this helps!

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


---
On Sunday, June 17, 2012 7:49:08 AM UTC+1, Dor Ben Dov wrote:
Sérgio,
Thanks for the quick reply. I am receiving this json 
{
  • error:
    {
    • errors:
      [
      • {
        • domain: "global",
        • reason: "required",
        • message: "Login Required",
        • locationType: "header",
        • location: "Authorization"
        }
      ],
    • code: 401,
    • message: "Login Required"
    }
} 
As an error. 

Dor Ben Dov

unread,
Jun 19, 2012, 11:00:14 AM6/19/12
to adsen...@googlegroups.com
Sergio 
Thanks again for you quick reply. Can you recommend or give me a link to on of your client libraries instead of coding from scratch as you said ? 

Regards,
Dor

Sérgio Gomes

unread,
Jun 19, 2012, 11:22:29 AM6/19/12
to adsen...@googlegroups.com
Hi Dor,

Of course! You can find the links to the client library projects at https://developers.google.com/adsense/management/libraries, and some introductory content on using several of them at https://developers.google.com/adsense/management/complete_guide.

Hope this helps!

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


---

Dor Ben Dov

unread,
Jun 20, 2012, 4:27:51 AM6/20/12
to adsen...@googlegroups.com
Thank you  Sérgio as always for the quick response.
Regards,
Dor
Reply all
Reply to author
Forward
0 new messages