OAuth C# Library for Google, Yahoo! Twitter - c#

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.

Related

Facebook Integration using C# and asp.net core

I'm starting a side project that will integrate heavily with Facebook. I'm going to use React in the front-end and it will talk to a REST ws made with asp.net core web api.
The idea is that in this API I will make the calls to Facebook.
Basically, I want to: login, get/post messages from Messenger, get/post comments and messages from a business page.
I googled a little and didn't find many resources or examples of how to do this integrations other than the Facebook documentation, that has a lot of stuff and I don't know very well where to look.
I also found this SDK for .NET but it looks a bit dated https://github.com/facebook-csharp-sdk/facebook-csharp-sdk and
So, my question is: Is reading the documentations entirely really the best solution?
If anyone could at least give me a hint where to go I'd be really thankful. Would it be better/easier to integrate with Facebook with other stack than c#/asp.net?
Also, if there's any other API, SDK or something already built in .NET that would help with that I'd be grateful.
Thanks in advance.
I am one of .net developers working with Facebook API more then 5 years and we have tried to use "Facebook SDK for C#". It has more issues then benefits. In result we end up with our own small Facebook API client. Basically it is just a "RestSharp" HTTP library, "Newtonsoft.Json" for serialization/deserialization and couple of generic functions where you supply Facebook API endpoint, and specify what class you expect back as generic parameter.
var accounts = client.Get<Accounts>("me/accounts");
var createResponse = client.Post<CreateResponse>("123456779/feed", postToCreate);
Facebook SDK for C# works great for standard .NET
https://hackerapp.com/net/
https://github.com/facebook-csharp-sdk/facebook-csharp-sdk
As for .NET Core I think you are out of luck at the moment. Unless you want to port it to .NET Core yourself.
Automated Customer Service bots are not uncommon in FB, but code is hard to find. I assume you had setup you App's domain and got it reviewed and approved by FB.
I tried to set a chat-bot with both, python and .NET, and I must say the python Api is much more complete, quick, and less buggy than the C# one. But, as far as I know, only the PyApi has integrated reactions (haven't tried them).
Therefore, you will need to do this manually by using the Facebook Api by sending direct GET/POST request triggered by your ASP.NET, or use some kind of inter-language platform such as IronPython to workaround the problem (which basically assembly the call, add the Key and secret, and CURL-it).
As final remark (not a very motivating one), there is documentation for post reactions, but not for message as you can see here (posts), and here (messenger).
You can perform a lot of the facebook operations on the client side using their javascript SDK.
https://developers.facebook.com/docs/javascript
In regards to getting up to speed on server side API calls from .NET you can check out the facebook graph api explorer. It can be helpful for discovery.
https://developers.facebook.com/tools/explorer/
In case someone is looking for this topic, I had the same needs myself. After not finding a Facebook SDK to use with .NET Core, I've created a new open source .NET Standard unofficial SDK for Facebook: https://github.com/developer82/FacebookCore

How To Create a gRPC Service In C# For Google Assistant SDK?

I want to communicate with the Google Assistant SDK via C#, and the SDK website said that for languages other than Python, I need to setup gRPC. Are there any good tutorials on this that I can use to get started? Thanks :)
https://developers.google.com/assistant/sdk/reference/rpc/
It should be possible to use assistant API SDK from any language that support gRPC (including C#), but if there is not pre-build assistant SDK available (looks like there is one for python, not sure about other languages), it is a bit more involved to do that.
In short:
The .proto API definitions for all public Google APIs (including assistant API) live in "googleapis/googleapis" github repo:
https://github.com/googleapis/googleapis/tree/master/google/assistant/embedded/v1alpha1
In short, here's what you need to do:
grab .proto definitions for the API from github
generate proto messages/stubs in language of your choice (basically the same as in gRPC tutorials on grpc.io).
authenticate with google using an auth library
(http://www.grpc.io/docs/guides/auth.html)
invoke API calls using a client stub generated in step 2.
Btw, the Google API client libraries are basically a pre-packaged result of these steps, sometimes with a bit of convenience layer on top of it improve the user friendliness of a given API.
Also, usually support for more languages is added to new APIs over time (so at some point there might be and official C# client library).

SSO Library on asp.net C#

What the the Open source Library available in the C#.NET for the SSO.
Basically I want to connect with Google SSO then will further continue with other providers.
Check out: DotNetOpenAuth
Also, you may want to check the following links:
http://msdn.microsoft.com/en-us/library/ms972971.aspx
http://weblogs.asp.net/hernandl/archive/2004/06/09/ssoformsauth.aspx
The Windows Identity Foundation (WIF) is Microsoft's official library for identity federation.
In your scenario you can also use Access Control Service (ACS) to federate identity with Google, Yahoo!, etc. All of them (and more) are supported out of the box.
Samples, documentation, etc. available here: http://claimsid.codeplex.com
If you have a bit more control over your servers, Shibboleth might be an option as well. It actually simplified a large portion of our application that serves thousands of users and it is well thought out, flexible, and scalable. Basically, define a directory that should be watched for credentials and Shibboleth takes care of the rest.
You should use DotNetOpenAuth, as stated in Kamyar's answer. If you want to see a whole implementation using DotNetOpenAuth and other series of auxiliary libraries, you should have a look at this article:
Integrating OpenID in ASP.NET Web Forms using DotNetOpenAuth

Building a C# / ASP.NET API using oAuth for API Authentication

Does anyone have any examples or advice for how to go about using oAuth to provide the authentication mechanism for an API that should be publicly exposed?
Specifically I'm talking about being an oAuth provider for my own API, not integrating or authenticating with anyone else's API.
For example, I wish to be able to issue API keys to developers that they can use to authenticate and access my API, much in the same way Flickr does, and as far as I believe oAuth can support this, but I'm not sure how the solution would be structured?
It appears that DotNetOpenAuth has an example by the way of the OAuthSeviceProvider project in the Samples folder included in the distribution. It's written in WinForms and isn't cleanly written but definitely serves as a good starting point.

Using OpenID for website Authentication

I'd like to implement OpenID in a new application using ASP.NET 2.0 and SQL Server 2005.
I chosen Twitter, Facebook and Google as potential OpenID providers.
I've found the Twitter implementation in .NET and I was studying Google's OpenID implementation, but I want to make sure that my design is (mostly!) flawless.
Is my database schema correct? I've associated a Reader with an ProviderOpenID which contains only a nullable Name column. I store the OauthToken and use that at every request to gain access to his profile and verify the login. Am I missing something?
Can anyone tell me if there is an Open Source Library for the .NET implementation of the OpenID provider for Google? I found the following tutorial on Google but I don't understand how it works. Has anyone tried this? Is this the best way to do this?
Facebook and Twitter are not OpenID Providers. It looks like you've already found solutions to their proprietary mechanisms however. But I just wanted to clarify what it is and isn't.
Yes, Google is an OpenID Provider. And for ASP.NET 2.0 DotNetOpenId, which you linked to, is the way to go IMO. Don't mind the wiki (which was down at the time but is up now). That's to the new DotNetOpenAuth library which targets .NET 3.5. Since you're targeting .NET 2.0 specifically (is this intentional?) you need to go with the DotNetOpenId that is on the Google Code project site (http://dotnetopenid.googlecode.com/) and ignore the "We've Moved" link, since that leads you to the .NET 3.5 library. What you want is DotNetOpenId v2.5.5. It comes with samples that show you how to get OpenID going.
Note that Google has a few peculiarities with how they do OpenID, the most notable of which is that typing "google.com" as the openid identifier doesn't work (currently). You have to type the longer https://www.google.com/accounts/o8/id
I think I was listening to a dotnetrocks podcast about the guy that wrote this tool authentication tool:
https://rpxnow.com/.

Categories

Resources