I have been bashing my head on this for days now trying to figure out how this is possible to do. I want to download the CSV's from Google Webmaster Tools which I have succeed in doing. However, I have to directly pass the username and password of the account I wish to access. For all other aspects of the webmaster tools, I simply have the user login and I exchange the token from there login with a re-useable session token.
I cant seem to use this method when it comes to getting the query data.
String next = "http://xyz.domain.com/auth"; //sets page to goto after user log's in so we can pass the token to application
String scope = "http://www.google.com/webmasters/tools/feeds"; // sets the scope of the token
boolean secure = false;
boolean session = true;
String urlFromAuthSub = AuthSubUtil.getRequestUrl(next, scope, secure, session); //generates the URL to forward user to loginto google.
On your capture page (the next parameter in the code above) you receive the token after successful login. Then you exchange it for the session token.
String token = "##########################";
String sessionToken = AuthSubUtil.exchangeForSessionToken(token, null);
//store sessionToken for all future use to interact with webmaster for this user.
Then finally we simply create our WebmasterToolsService
object and set it's AuthSubToken
to the session token, and DONE!
WebmasterToolsService myService = new WebmasterToolsService("DemoWebmaster");
myService.setAuthSubToken(token);
However when trying to download the CSV, I have no choice but to use full credentials of the Google user.
String host = "www.google.com";
String dl_list_url = "/webmasters/tools/downloads-list?hl=%s&siteUrl=%s";
String sites_path = "/webmasters/tools/feeds/sites/";
WebmasterToolsService svc = new WebmasterToolsService("DemoQuery Service");
svc.setUserCredentials("[email protected]", "123456");
After that I can do anything with the webmaster API as I am passing the full client login. However, for the application I am building, I need to not store the users full Google credentials.
I seen one company that has managed to pull this off somehow when you add the Google webmaster API. But I cant seem to see how it is possible. Any ideas?
About that company that is doing it, who are they, are they giving some kind of public tool or mashup? Probably they are just using some unfair trick to keep your data. Do you have an URL?
As far as i know (and i did know a further research just in case) that's not possible. for a few things:
So, i am afraid you wont be lucky.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With