This project is read-only.

Integrating FacebookConnect with the existing user login

Feb 7, 2011 at 3:32 AM

Hi there all. Thanks for helping me advance.

I am currently working on a FacebookConnect Module that integrates facebookConnect with the existing user login provided by OrchardCMS. It is part of my school project and we have not been taught about this.
I am also kinda new to C# and the new @Razor Engine and i am lost on how to start :(
Basically the scenario below will explain how my module is to work.


Users comes across the site i am running. They want to login to use my advanced features in my site.

User A has an existing facebook account and so he uses his facebook account to connect with my website.
When doing so, she/he automatically becomes a member with "Contributor Role" within my CMS.
He/She also has the permissions like viewing the dashboard and also creating posts in my blog with the CMS.

User B doesn't have a facebook account, therefore he registers an account provided by Orchard CMS.
He/She has the permissions like viewing the dashboard and also creating posts in my blog with the CMS.


I am very lost and i would be really thankful if the orchard community can help me with the coding part as i am also running out of time for my project submission.

Thanks alot.

Feb 7, 2011 at 3:43 AM

Are you familiar with the Open Auth Module for Orchard? Take a look at:

This is an open source work in progress. It would appear that what they are doing is quite similar to what you want to do.

Feb 7, 2011 at 5:55 AM

@JonnyBoats - Thanks Jonny for the information, but i am not very familiar with the module. I happened to download the source, but i am not able to get it working.

Feb 7, 2011 at 12:45 PM

@surajsuresh: If you are accustomed to creating Orchard modules (event the most simple ones) - take a look at the It provides the C# API to Facebook, so you won't have to deal with the API wrapper yourself. There's also a very good documentation.

If you haven't written Orchard modules before - I'd highly advise you to read the developer docs first. The Orchard Jumpstart module I recently made could be also of great help to you - it contains the basic module functionality you can start with and lots of comments inside.

Cheers, Piotr

Feb 7, 2011 at 2:56 PM

@pszmyd: thanks alot mate(: I will look into them.

Feb 7, 2011 at 4:07 PM
Edited Feb 7, 2011 at 4:08 PM

No problem:) I'll keep you posted when I find something that would help you further. Cheers

Feb 19, 2011 at 6:21 PM

@surajsuresh: Just wanted to ask how the module development keeps going?:)

Feb 20, 2011 at 11:03 AM

@pszmyd: Hi there Piotr, i have sent you an email, could you pls help me look into it. Thanks:)

Feb 20, 2011 at 8:46 PM
Edited Feb 20, 2011 at 8:47 PM

I've also done facebook connect integration into my mvc sites, so feel free to ask me any questions as well.

Feb 21, 2011 at 2:05 PM

Hey guys, I am writing the module. Sorry if it didnt compile when you got latest, best thing to do is to get latest from the dev branch :)

I have just built in oauth wrapper that has linq2twitter integrated with it. Facebook will be the next step, though I may release in to a beta stage before facebook goes in just to get community perception... as feedback is really important to me.


Feb 21, 2011 at 2:29 PM


Nick, I've been working on the L2T integration too (for messaging purposes), so maybe we'd join forces?:)


Feb 21, 2011 at 6:37 PM
Edited Feb 21, 2011 at 7:48 PM

sounds good dude. Here is an example of code in another module that will work with my module :-

        private readonly IOAuthTwitterAuthorizer _twitterAuthorizer;
        private readonly IOrchardServices _orchardServices;

        public HomeController(IOAuthTwitterAuthorizer twitterAuthorizer, IOrchardServices orchardServices) {
            _twitterAuthorizer = twitterAuthorizer;
            _orchardServices = orchardServices;

        public ViewResult RetrieveTweets() {
            var twitterCtx = new TwitterContext(_twitterAuthorizer.GetAuthorizer(_orchardServices.WorkContext.CurrentUser));

            var tweets =
                from tweet in twitterCtx.Status
                where tweet.Type == StatusType.Friends
                select tweet;

                tweet => Console.WriteLine(
                    "Friend: {0}\nTweet: {1}\n",

            return null;

Note all you need is IOAuthTwitterAuthorizer twitterAuthorizer and then pass this _twitterAuthorizer.GetAuthorize(*/user*/) in to the context. This will work with any user that you have on your system that has a twitter account associated.

Is this what your looking for?

Also blogged

Mar 8, 2011 at 6:46 PM


I setup Facebook Connect in Orchard, but don't understand the Permission setting... What value do I enter here?


TJ Havens

Mar 8, 2011 at 7:59 PM

Facebook requires you to explicitely ask user for specific permissions. This value is a list of string values separated by "," - you can find the list of all available permissions here:


Mar 10, 2011 at 11:05 PM

Thank You, that answered my question.

TJ Havens

Mar 11, 2011 at 4:31 PM


I want to place the Facebook Connect button outside of the available zones, I'm sure using CSS, this can be done, anyone know the selector for the facebook button?

TJ Havens

Mar 11, 2011 at 8:32 PM

Why don't you just add a zone where you need it in your theme's layout file and in the theme's manifest?

May 15, 2011 at 11:07 AM

Every time when I try to login with facebook I got next error:

ID, secret and Permissions are set.

May 15, 2011 at 12:07 PM

For 3rd party modules it's best to ask at the module-specific website or contact the owners through Orchard Gallery.