How to connect to Facebook like Zoho does in ASP.NET MVC? - c#

Pretty much all the tutorials I found on authenticating users using Facebook, make use of a new window which I find to be an ugly solution. But www.zoho.com on the other hand does this much like the way that OpenID works. Can someone tell give detailed instructions on how Zoho does this?

Facebook has a full page redirect mode but it's their "legacy" API. Their newer one is the popup style that you dislike. Their newest one is OAuth 2.0, which is back to the full page redirect from what I've seen.
DotNetOpenAuth 3.5, when it ships, will include OAuth 2.0 support and a Facebook login sample. Slated for at least a few weeks out before it's released though.

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

Posting to my Facebook timeline from C#

Can someone please provide me with the workflow required to be able to simply post a message to my Facebook page? From what I have read, DotNetOpenAuth 4.1 does not support Facebook's OAuth 2.0 protocol? If someone has a better suggestion for an OAuth2 library, I'd like to hear it and if you can provide an example of how to post a message to a Facebook page, that'd be great!
Also, this is a Winforms application, not a Web Application.
OAuth2 clients are simple enough to write that you almost don't need a library. Try following the Facebook documentation yourself using HTTP calls in your winforms app and see if you can get it to work.
For client apps like winforms, the trickiest part can sometimes be that there isn't an obvious redirect URL.
DotNetOpenAuth 4.x does support Facebook (by implementing workarounds for FB's non-compliance with the spec).
I generally use ComputerBeacon Libarary. It is quite fluent
http://computerbeacon.net/library/facebookgraphtoolkit

Windows Live Authentication in MVC3

So looking around the web, I see tons of tutorials for integrating Live authentication into projects, but have found almost nothing useful on integrating into an MVC project. I'm pretty new to MVC, and have some limited experience with Web Forms.
The site I'm trying to make must allow authenticated Live users to submit and vote on various items, so I need to figure out the best way to keep track of users' submissions as well as votes so that they can vote only one time on a submissions, and cannot vote on their own submissions.
I'm wondering if anyone can simply point me in the right direction here. I see that similar questions have been asked, but the answers to them didn't seem to lead me to an answer.
I suggest the OAuth2 authentication, Live supports it for some time. You can use any existing approach to OAuth2, dotnetopenauth is fine.
MVC does not change anything. You just have your forms authentication login controller which initiates the redirect to the authentication provider and consumes the return response.
Some links to get you started:
General info on OAuth2 for various providers:
http://ben.onfabrik.com/posts/oauth-providers
OAuth2 on Live:
http://msdn.microsoft.com/en-us/library/live/hh243647.aspx
Integration of OAuth in an MVC application:
http://scatteredcode.wordpress.com/2011/12/01/dotnetopenauth-oauth-and-mvc-for-dummies/

Login with Vimeo using C#

I am currently working on a project and in this I have to implement login using Vimeo account. Furthermore I get application key and other information by registering my application on Vimeo. But on the Vimeo site there is no help how to implement the login functionality, and I am new to it. Can anyone help?
Vimeo uses OAuth, so you should be able to find an OAuth library for .NET and start working pretty quickly. This blog post looks like a good starting point and covers authentication as well as searching.

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