Retrieve my adsense report as server application - ruby-on-rails

All I need is like so,
I want to use Ruby and Google API to retrieve MY adsense report (like page views, CTR ...) and save it into my database. (I want it to be automatic)
When an user requests to my page, I will show my saved report to him.
I think it was simple but it's not actually because OAuth 2.0 needs users to authenticate with google. I dont know how I can do it because I dont have any browsers on my server. Is it possible to do so? Can anyone show me how to do it?

The AdSense Management API can be used with the "Installed application" OAuth2 scenario. You just need to generate the refresh token once (you don't need browsers on your server and no human interaction is needed after this).
Here's the generic guide:
https://developers.google.com/adsense/management/getting_started#auth
And the Ruby client library, with the adsense sample:
https://github.com/google/google-api-ruby-client-samples/tree/master/adsense
The client library handles auth for you.

Related

Ad Sense Management API Generate Report without OAuth?

I am creating an Application that displays the info of a Single Adsense account for all users. Do I still need to use OAuth for this? Because I do not need any user information, I simply want to show them the Information of one account. Is this possible? I want to do this:
https://developers.google.com/adsense/management/v1.3/reference/accounts/reports/generate#auth
Without using OAuth. Thank you.
You must use OAuth to access your AdSense Account via the Adsense API.
Check the examples, make one run and then substitute your own code.

Google Drive API for iOS: OAuth2.0 with an application-owned account

I'm creating a simple iPhone app. The basic premise is that the app will display some data (That I provide online) on the application. The data changes over time, so the app has to draw the data from online and display it. I don't have a significant programming background so I don't want to use my own server.
Thus, I thought it would be significantly easier to just put the data into some documents on a Google account and then access them programmatically via the Google Drive API. I could then update the data in my Drive account and it would get updated in the application. The key here is that I am ONLY accessing ONE account that I own MYSELF. The users' accounts are not being accessed. Therefore the goal is to never have to log in manually. It should all happen behind the scenes, aka, it should look like a server, not a google doc.
With this in mind, it doesn't make sense to show the Google Accounts sign-in page to my users as the standard OAuth2.0 tutorial shows here:https://developers.google.com/drive/quickstart-ios#step_1_enable_the_drive_api
I should be able to access my own data by somehow hardcoding in my username, password etc. Google agrees here: https://developers.google.com/drive/service-accounts#use_regular_google_accounts_as_application-owned_accounts
The above link mentions a "refresh token" that I'm supposed to save. However, I have no idea how to build and save that token, or even for that matter, where to find it.
I've gone through both the basic tutorial and the Dr. Edit Tutorial for iOS, but they both assume that the application is accessing USER accounts not application-owned accounts.
I'm not asking for someone to write the code for me (though tidbits are nice), but if you can point me to a step-by-step guide or related sample code that would help me get started that would be awesome. I'll even come back and post the code that I use!
EDIT: Since I realized that the Google Drive API wasn't something I could use for what I am trying to do, I eventually found Parse which is an awesome tool that handles all the server backend for me and is free at the basic level.
Google APIs objective-C client library doesn't support service (application-owned) accounts, because they are supposed to be used by a server-side apps, instead of clients -- you shouldn't be distributing your private key as a part of an app.
If you would like to distribute content from a service account, maybe you should write a server leg to do the authentication and pass clients credentials in a secure way for them to talk to the API on the behalf of the service account. Or, use Web publishing to make documents universally accessible without authorization and authentication if privacy is not a concern.

Using Google + API and LinkedIn API within a desktop application (without prompting user for username-password)

I'm going to create a page which will download user's activity and save it in an .xml file because my iphone app needs to process it. The problem is that I cannot prompt the user for login-password... so I was wondering if there is a sort of permanent key that I can use to access into linkedin and gplus?
Thank you.
Google+
I can field the Google+ part of your question :)
You can access your users' public activity using the REST API's activity list method. To identify who they are you'll need to send them through an OAuth flow during which they will authorize you to know who they are on Google+.
The best way to get started doing server side OAuth flows in Google+ is to grab one of the starter projects and go through the included readme. That will give you a working project to copy code out of, or develop upon.
I'd include a code sample to show you how it works, but I don't know what would best apply to your back end :)
Linkedin
I'm far from an expert on their APIs, but it looks like the flow would be similar using OAuth.

Twitter Application using php?

I need to develope a Twitter application in php,
Requirements are that that my application should get access token from user and then using that access token, my application should be able to get backup of the twitter user tweets, followers list, timeline, messages etc.
I created an application on twitter and got the consumer key and secret.
Please tell me how i start now, and what is the best php library that will be enough for my requirements.
Thanks
The best place to start is http://dev.twitter.com
If you want to really jump into things, check out the listing of PHP libraries that you can use: http://dev.twitter.com/pages/libraries#php
Edit: I also suggest you read everything under Guidelines and Terms, Authentication, and REST API & General on this page: http://dev.twitter.com/doc

Customising Tweets

I have some PHP creating automatic Twitter updates, which in the small print at the bottom reads "[date/n minutes ago] via API".
Is it possible to somehow change the "via API" part to something more useful and descriptive?
It looks like you have to utilize OAuth authentication. As per the Twitter API Wiki:
How do I get “from [MyApp]” appended to updates sent from my API application?
We now recommend developers use OAuth to perform authentication with the API. When applications use OAuth, Twitter automatically knows the source of status updates. We are therefore able to append source attribution (from "[MyApp]") to tweets. If you would like tweets from your application to recieve a source parameter, please register an application and implement OAuth authentication. We will automatically include your application as the source for any tweets sent from your application.
We originally allowed applications to create a source paramter for non-OAuth use but that has been discontinued. Applications pre-OAuth source parameters will remain active, but new registrations are no longer accepted.

Resources