I want to use Google Webmaster Tool API in c# application. I have gone through different documents that are available on https://developers.google.com. Unfortunately I did not get any working example of using Google WT API using .Net . I have also seen the “Client Libraries” (“https://developers.google.com/gdata/docs/client-libraries”) for this.
Can anybody provide me any working example of how to use Google Webmaster Tool API in c# ?
I have account on Google WT, and want to download .CSV reports for “CrawlErrors”, “InternalLinks”,” TopSearchQueries” etc.
Thanks
Here you can find the official C# library source code for Webmaster Tools Data API:
http://google-gdata.googlecode.com/svn/trunk/clients/cs/src/webmastertools/
And here you can find examples of usage in the form of unit tests:
http://google-gdata.googlecode.com/svn/trunk/clients/cs/src/unittests/webmastertools/
More specifically, examples of authentication, QuerySites, QuerySitemaps, QueryKeywords, etc.:
http://google-gdata.googlecode.com/svn/trunk/clients/cs/src/unittests/webmastertools/WebmasterToolsServiceTest.cs
Note also there are some bug reports, your mileage may vary:
http://productforums.google.com/forum/#!topic/webmasters/gh7vCzYfm6A
If you're still getting 403 Forbidden, the reason behind this might be the 2-Step Verification installed on your Google account. If that's the case, try generating a dedicated password in the Application-specific passwords section of your Google account, and use it with GDataCredentials(this.userName, this.passWord).
Alternatively, you may try adding sub-accounts at https://www.google.com/webmasters/tools/user-admin and use of one of them. The 2-Step Verification concern may apply to those accounts, too.
Related
I don't know exactly if I should ask this question here, neither if I'm using the exact right tags, but... I need to add a 2FA to a system I'm developing and, while I was looking for the best available options of 2FA, we thought about adding Microsoft Authenticator support to it (We liked Authy, Google Authenticator, etc, but we tend to prefer Microsoft solutions here). It seems it used to exist a way of adding Microsoft's 2FA to our site, but is there a way to do it now in 2019? If so, is it free (We got Microsoft developer accounts... If having them is the only paid requirement, we're ok)
Microsoft Authenticator just implements the Time based OTP mechanism ( https://en.wikipedia.org/wiki/Time-based_One-Time_Password ).
If you do not have Azure accounts, the Microsoft authenticator can scan a QR code with the following embedded URL
otpauth://totp/UserName?secret=Some-long-secret&digits=6&issuer=CompanyName
Once the Microsoft Authenticator has scanned this QR Code, it will start showing you one time passwords.
On the server side, you can use a library like https://github.com/samdjstevens/java-totp
The library can be used to generated the secret or verify the OTPs generated by the Microsoft Authenticator.
The Microsoft and Google Authenticators just implement the TOTP mechanism to provide a serverless (read: offline, you only need an accurate timestamp) one time password mechanism. You can use any generic TOTP library to generate a user specific shared secret, possibly encode that one as QR image for ease of configuration and then validate if a provided token matches the shared secret and has been created in the last +-n seconds.
You can get started here: https://github.com/BrandonPotter/GoogleAuthenticator
Although the library is called "Google Authenticator" it can also be used with Microsoft's Authenticator because they basically function the same way. TOTP
I read the OneNote Api Documentation https://dev.onenote.com/docs
But I don´t understand how to make a request to the OneNote API with c# web application in order to get all the pages in my OneNote.
I already got the Application Id, Application Secret Id and Redirect URL, but i don´t know where do I have to use them, because I have never done and http request and the documentation only provide the following: https://www.onenote.com/api/v1.0/me/notes/pages, so I don´t know how to send the id´s, redirect url and Authorization: Bearer.
Could you provide me the specific code to get a successful connection to OneNote API using Application Id, Application Secret Id and Redirect URL.
And the code structure to make a http request in order to get all the pages, notebooks, etc
I would appreciate if you could help me with this.
I would recommend using Microsoft Graph instead of the standalone OneNote API. Microsoft Graph includes support for OneNote. There is also an SDK for .NET available. There are also code samples for ASP.NET, UWP and Xamarin.
Before you can use the Graph API (or most any REST API for that matter), you will need to obtain an authorization token (i.e. the bearer token you referred to in your question). There are libraries available for simplifying this process. Behind the scenes, these libraries are executing an OAUTH 2.0 flow. You can read about what is going on under the covers here.
I believe the link they have on the OneNote Dev page is broken. The team has put together a public repository that contains a bunch of sample code in a myriad of languages including C#.
This is the main repo
Web API (ASP.NET Core) Repo
I believe the easiest way to understand these concepts is to look at sample code that does authentication. I recommend this sample:
https://github.com/OneNoteDev/MsGraph_OneNoteApiSampleAspNetCore
Btw - the demo is here: https://onenoteapisamplegraph.azurewebsites.net
Thank you everyone I have Checked all the links that you provided me and they were very useful, I did a connection to Microsoft Graph with the authorization token and I got access to my OneNote pages.
Thank you for your help.
I created a proof of concept using Google Custom Search Engine. I'm using the following C# library for that: Google.Apis.Customsearch.v1
The concept was working and accepted by the customer. The customer then upgraded to the paid version of Google CSE: Google Site Search.
But when using the API key provided in the panel of the paid version, I get the following error:
{“Google.Apis.Requests.RequestError\r\nInvalid Value [400]\r\nErrors [\r\n\tMessage[Invalid Value] Location[ – ] Reason[invalid] Domain[global]\r\n]\r\n”}
The API key in that panel seems to be a public key, you can actually find it on numerous websites.
We can only get it working again, by using our own project key we created at https://console.developers.google.com. This comes with a 100 request/day limitation, unless you also go for the paid option here (making it a double expense).
Is it at all possible to make this work with this library AND the paid version of Google CSE?
Google Site Search and Google Site Search API are two different things.
To use the API you need a key created on google developers console. The quota associated with the key is the quota for the Google developer account Not the user that has authenticated the application.
Now they upgraded there Google sites search which means they should have some kind of support with that. I suggest they contact google and see if they can get a google developer project upgraded as well they will have to create there own project and will no longer be able to use yours. I have never tried to my knowledge they are separate and you have to pay for them separately but it wont hurt for them to contact Google and ask.
I'm looking for a library that will allow me to use OAuth in my ASP.NET/C# applications, such that I can authenticate users using one of the following OAuth providers
Google
Yahoo!
Twitter
I've looked at various open source libraries and find that there is one issue or another with them (some don't work at all, some work against one service not not others). I've also looked at OAuthDotNet and I must admit that I find it way too complicated to figure out how to begin using it and so I've not really tried it.
So essentially I'm looking for a simple to use library that works against the above mentioned providers (at least).
Jackie I have a blog post on this
OAuth C# Library
There is a library (including source code) and a simple sample project you can download to get started with this.
I've tested it against
1. Google
2. Twitter
3. Yahoo
4. Vimeo
You don't mention the version of OAuth you'd like to support so you should know that the library supports OAuth 1.0 revision A only and not OAuth 2.0. Most site today support OAuth 1.0 revision a.
I've kept the sample project very simple intentionally, so those starting out down this path don't have to struggle trying to figure out how to use the library. The library is not "over engineered" like I believe some libraries out there are so it is fairly simple to enhance if need be. But I suggest you attempt that only after you've familiarized yourself with the OAuth protocol.
The project in fact is an open source project hosted on Google code (link in the blog post).
Note: Due to the way Yahoo! has implemented their service it is not possible (or not simple) to test against their service from your development machine.
I hope this helps.
DotNetOpenAuth is open source library that supports OpenID, OAuth and
support for your site visitors to login with their OpenIDs.
Twitter Libraries in different languages.
Google Data client libraries are written to support client applications to access APIs.
Libraries are written in different types of languages.
If you're looking to just to Twitter then I would suggest twitterizer. It's a great library with a fairly good community and support.
http://byatool.com/c/connect-your-web-app-to-twitter-using-hammock-csharp/ (Wayback archive link.)
http://hammock.codeplex.com/ (Moved to github here: https://github.com/danielcrenna/vault/tree/master/hammock)
these link might be helpful.
I have an Idea for a simple webApp that would cross-link information from Evernote to Google Calendar. I was able to find a good Evernote Quickstart project but I am now searching for something to start with to begins accessing Calendar. Please advise if you know any good resources with code samples that would show me how to do the dirty work (i mean the authetication either via OAuth/AuthSub).
From what I have read about using OAuth with Google, it seems that you have to have a registered domain - I need to be able to access the service from my laptop's development server, so I guess I must stick with AuthSub.
When I 'googled' for this topic I found many questions similar to mine, yet none of them has been answered in satisfactory way.
Thank you in advance for your help.
UPDATE: I'm starting to think that either I am missing something or nobody is using AuthSub in ASP.NET...
I've recently created a sample how to use Google OAuth in ASP.NET and Google using the Dotnet OpenAuth library:
Using Google OAuth in asp.net
I hope this sample helps :)
Dominik
UPDATE March, 2015
By April 20th, Google will no longer support this api - Therefore I needed to migrate to OIDC. See my recent article here:
OIDC lightweight library for asp.net
In order to use OAuth, you must register your domain with Google at the following page: https://www.google.com/accounts/ManageDomains. This registration will give you the credentials you need to sign your OAuth requests. However, you could still specify a different oauth_callback url in the user authorization url. So the registered domain is not related to the oauth_callback.