I am developing a net console application for downloading adwords reports.
It is work perfectly fine for facebook reports.
But when I am doing the same with GDN, Google AdWords' csv file is downloaded in HTM format with no actual data.
My Ruby code is:
link='link url in scheduled report'
GDN_Form = page.forms[0]
GDN_Form.Email ='LOGIN ID'
GDN_Form.Passwd = 'PASSWORD'
puts "Redirecting to Page"
#puts page.to_html
#Subitting the login Page
GDN_Form.add_field! 'send','Submit'
page = agent.submit(GDN_Form, GDN_Form.buttons[0])
agent.get(link)
page2 = agent.get(link)
puts page2.title
agent.get(link).save('C:\Ruby21\DownloadedeReports\ClientName.CSV')
The file is downloaded, but actual data is not downloaded.
I have to to do this task without using Google APIs.
Google login procedure has changed, first you need to find login url which it comes with _ga cookie id which is dynamically changed.
Here is the e.g.
https://accounts.google.com/ServiceLogin?service=adwords&continue=https://adwords.google.com/um/identity?sourceid=awo&subid=in-ww-di-awhp&hl=en_IN&_ga=1.229603486.307864125.1437111208&hl=en_IN<mpl=signin&passive=0&skipvpage=true#identifier
and login page contains email id which you have to find using mechanize then click on the next, same you have to do with password. After submit click on your schedule report url.
Related
I'm trying to get the Google Sheets API to work with node and I've got as far that it asks me to sign it with my Google account and the allow the app to view my Google Spreadsheets. After I press allow it redirects me to a Page not found saying "ERR_CONNECTION_REFUSED". In the URL it reads "code=4" but I can't find what this stands for. I'm currently stuck in my console waiting for a code from this page. .
My code is the exact same as on the API documentation but I had to change "credentials.installed" to just "credentials" because otherwise it didn't work.
Has it maybe something to do with my callback URIs? I have both "Authorised JavaScript origins" and Authorised redirect URIs" as just "http://localhost:8080".
My credentials.JSON looks like this
{
"client_id":"XXXX",
"project_id":"XXXX","auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri":"https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
"client_secret":"XXXX",
"redirect_uris":["http://localhost:8080"],
"javascript_origins":["http://localhost:8080"]
}
In summary: I get a "Page not found" instead of the code that you're supposed to paste to the console after I press the "Accept" button.
I selected "web application" instead of "desktop application". Just download credentials JSON and copy code directly from quick start and it will work. My bad.
I am having an issue here. So I have a rails application that is using the fb_graph2 gem. My application allows users to share an article from my application to their facebook wall. I have created a landing URL for my application that tracks the click ( for metrics on my application ) and then redirects the user to the original article.
I run my tracking URL through the FB Linter and it pulls all my data correctly but when I post to from the my application it does not pull any OG data. If I paste the tracking URL into FB it pulls the data. But when coming from my app, it get the image that is below. You can test the url from my dev server using my dev app.
https://raydodev.herokuapp.com/api/v2/common/articles/metrics/track/1203
how my data shows up on facebook when posting from my rails app
Using the FB Graph i am posting with the code below:
me = FbGraph2::User.me(user.fbaccesstoken)
msg = {
message:'foo',
picture: 'https://bar.png',
link: 'http://foobar/page.html',
name: 'This is the article title',
description: 'This is the article description'
}
me.feed!(msg)
Any help would be greatly appreciated
I have been trying to implement the OAuth v2 for Microsoft Accounts for my website. Its currently in development stage and so am testing on localhost. The Website is an ASP.NET Core MVC 5 Application.
I have followed the tutorial here to implement OAuth for Twitter, Google and Facebook accounts. I found this to be quite simple with only a few small issues that I was able to solve with simple google searches.
However I have spent several days trying to understand what is happening when trying to use Microsoft Account authentication on my site.
I have watched the video here on registering an application in the Microsoft App Registration Portal. At around minute 6 in the video a short demo shows how to set up the App. You can see my App details in the following screen shot:
In the video at about 7.5 mins in, there is a small section explaining how to test the App by building a URL string.
On submitting the query string to the browser the page is redirected as expected to my App page as you can see here:
In this instance I was all ready signed into my Microsoft Outlook account. If I wasn't signed in I would be prompted to login to a Microsoft account. Logging in, in this case choosing my already signed in Outlook account causes the page to be redirected back to my site as seen in the following screen shot but because the site didn't send the request its not expecting a token sent back for login so nothing really happens. This is expected behaviour, at this point as I was only testing that the Apps end point was working as expected.
[
The next stage is to test the functionality from my website. This is where I always have issues. To activate the OAuth functionality for Microsoft Account login requires simply un-commenting a couple of lines of code within the Startup.Auth.cs file in my websites App_Start folder and passing in the Apps ClientKey and ClientSecret values as can bee seen in the following code snippet:
app.UseMicrosoftAccountAuthentication(
clientId: System.Configuration.ConfigurationManager.AppSettings["MicrosoftOAuthClientID"],
clientSecret: System.Configuration.ConfigurationManager.AppSettings["MicrosoftOAuthClientSecret"]);
This code basically adds a little button to the login page that allows you to choose Microsoft login as can be seen here:
[
When I click the Microsoft button I get the following error page:
And the query string returned contains the following:
https://login.live.com/err.srf?lc=2057#error=unauthorized_client&error_description=The+client+does+not+exist.+If+you+are+the+application+developer%2c+configure+a+new+application+through+the+application+management+site+at+https://apps.dev.microsoft.com/.&state=JMxMRuKaOiYWCQw_Uqkhv3gLQn3ULlkG2miM4ymcHhTK5niXVQl5n4L0a6VoWeEKmFM7T1ciU2oQAh26_Y0i2DMjdt6BOAtpjNeMaSpBq4wbCjva9lOuctOUIWwoFdTEGvxJ4M904lUsoudd9e9cYi6eiH3JF81HB5ouQSus2ddE1sVUQLw-YB1GjUL79y2muFaBFIOIOk75oCV2IxX4cFO2rJU04K9Se6gxu698WpzR8taUB2c6tK9u0dBisckhavf0IvKB9dWQq-IVwQgvaA
Anybody know why or what is happening????
Now I have read in several of my many searches while trying to understand whats happening when I try to test the App from my site rather than a URL directly in the browser that I should have
/signin-microsoft
appended to my Redirect URL in the App Portals configuration. I have Tested with my Redirect URL set like that and this does not work. I get a HTTP ERROR 500 sent back because the page signin-microsoft does not exist. So this is not my problem.
Please help if anyone has had the same issues and solved it.
EDIT: I should have mentioned that I was initially trying this using Local IISExpress but after reading some posts saying it can be done only on IIS so I published my site locally to IIS.
You can skip to the problem below but in short I can auth, upload and get a file list but it doesn't correspond to the gmail account I setup with the service account and google dev console
longer version:
I created a new email account say blah#gmail.com and used the google development console to enable drive, contacts and a few other APIs for my project.
Then I created the service account API keys/secrets and downloaded the client_secrets.json as well.
It took a while but got authentication working with the ruby google-api-client and I can login via rails console.
Problem:
I'm getting file.list but it only has the Getting Started.pdf even though I've created a few docs and spreadsheets on the blah#gmail.com service account.
I can also upload a file but don't see it.
I "think" that it's uploading to Google Apps related account? but I have neither set one up nor do I own domain for the organization I'm setting this up with.
I have no idea where the files are going or uploading or how I can access the drive account I actually did setup with blah#gmail.com
what's going on .
EDIT:
Can i get some code example on how to modify this to impersonate user?
require 'google/apis/drive_v2'
Drive = Google::Apis::DriveV2
#drive = Drive::DriveService.new
scope = 'https://www.googleapis.com/auth/drive'
#drive.authorization = Google::Auth.get_application_default([scope])
#give me list of files
#files = #drive.list_files
puts "Search results:"
#files.items.each do |file|
puts "- File: #{file.title} (#{file.id})"
end
If I have to setup google apps this might be tough since they only have subdomains and I don't have direct access. The type of thing I wish I had been told up front.
I've recently enabled the Facebook Open Graph stuff on my web app (so and so has just read this and that on here and there). Now I post the request to Facebook when a user posts something, as part of the page load in the controller. The problem is I receive the following error:
HTTP 500: Response body: {"error":{"type":"Exception","message":"Could
not retrieve data from URL."}}
My first thought is that the open request to load the page is blocking any FB scraping of OG information, as it seems after it's been cached I no longer receive this error.
Is this likely? If so, what's the best way to work around it?
WHY THIS HAPPENS:
I had this same problem today, and it is because your Koala script (assuming you're using koala - if not, you should try it out because it's great) sends its request to Facebook before your URL is up. This means that when Facebook registers the post, it comes to the URL you specified to pick up the meta tags. Unfortunately, the page itself hasn't been loaded yet, giving it a 500 error
HOW TO SOLVE IT:
Use the delayed_job gem to prevent your post call from occurring before the page loads, which allows facebook to scrape your metatags correctly.
FOR EXAMPLE:
def post_to_facebook([ACCESS_TOKEN])
graph = Koala::Facebook::API.new([ACCESS TOKEN])
graph.put_connections("me", "[APP NAMESPACE]:[ACTION]", :[OBJECT TYPE] => [OBJECT_URL])
end
handle_asynchronously :post_to_facebook