chaplinjs / chaplin

HTML5 application architecture using Backbone.js
http://chaplinjs.org
Other
2.85k stars 232 forks source link

How to trigger Facebook authentication from Visual Studio solution. #11

Closed crussi closed 12 years ago

crussi commented 12 years ago

I am making good progress with my application built using Chaplin. I am getting lists to display and I am currently working on editing my objects. I want to thank you for building such an elegant framework. I love backbone.js, but, I kept finding the need to fill in the missing gaps (e.g. controllers, disposing objects, pub/sub, etc.). I am so happy I discovered Chaplin.

I develop in visual studio and I built a solution and migrated all the sample chaplin application files into it. Because the sample Chaplin application has to be run using the mock domain chaplin.moviepilot.com I can not get the Facebook service provider to work when I run my visual studio application. When running a visual studio application it just runs in localhost with a port number. Eventually, I want to authenticate my users by using either Facebook, Gmail, Twitter, or allow them to create a user account. Can you give some guidance on how I might run Facebook authentication without the need to use the mock domain chaplin.moviepilot.com? So much depends on having an authenticated mediator.user that it is difficult for me to move forward.

I have looked at the Facebook provider, however, I have to admit that it is beyond my skillset to understand right now. I don't want to change the provider, I just want to enable my application to use the provider without running under the domain chaplin.moviepilot.com.

Best regards, Chris

molily commented 12 years ago

There are some instructions in the manual regarding the Facebook login: https://github.com/moviepilot/chaplin#toc-example-application

In short, you have to create an app at Facebook.com. Go to https://developers.facebook.com/apps and click on “Create New App”. On the following page you will get an App ID which is a long number, i.e. 325938621788345. You can also set domains which are allowed for this app.

Copy the app ID, open facebook.coffee/facebook.js and paste it into the facebookAppId variable on the top of the file.

If you don’t have a client-side login or your app doesn’t handle the login client-side – for example when it’s not a total single-page app but the actual app is behind a classic login form – you should remove the SessionController, the mediator.user and so on completely. Nothing important should rely on the user authentication, just the example controllers/models/views, especiall the login views.

crussi commented 12 years ago

Hi Mathias, Thank you for your advice. I was already familiar with your documentation, which is really well written. The problem is how to get the Facebook authentication to work when debugging in Visual Studio. Based on your link I was able to find out more about FB authentication. I then found that I can register http://localhost as my FB app domain. http://stackoverflow.com/questions/5515594/debugging-facebook-connect-with-local-iis-visual-studio

I will try this next :-)

Best regards, Chris

Sent from my iPad

On Mar 14, 2012, at 10:55 AM, Mathias Schäferreply@reply.github.com wrote:

There are some instructions in the manual regarding the Facebook login: https://github.com/moviepilot/chaplin#toc-example-application

In short, you have to create an app at Facebook.com. Go to https://developers.facebook.com/apps and click on “Create New App”. On the following page you will get an App ID which is a long number, i.e. 325938621788345. You can also set domains which are allowed for this app.

Copy the app ID, open facebook.coffee/facebook.js and paste it into the facebookAppId variable on the top of the file.

If you don’t have a client-side login or your app doesn’t handle the login client-side – for example when it’s not a total single-page app but the actual app is behind a classic login form – you should remove the SessionController, the mediator.user and so on completely. Nothing important should rely on the user authentication, just the example controllers/models/views, especiall the login views.


Reply to this email directly or view it on GitHub: https://github.com/moviepilot/chaplin/issues/11#issuecomment-4503891

crussi commented 12 years ago

I am taking the path of removing client side authentication and relying on server side authentication. Unfortunately, this effort has taken the wind out of my sails :-( and I have had to stop working with Chaplin in order to build my server side authentication. I hope to be back working on my Chaplin sample product soon.

molily commented 12 years ago

That’s a pity. If it helps I can create a branch for you without all the client-side login stuff. Feel free to contact me directly via mathias.schaefer@9elements.com for further questions.

crussi commented 12 years ago

You are too kind! Please don't think I am giving up on Chaplin, far from it. It is so well written that I no longer think of backbone as complete without it. I guess I might have the same issues as others when it comes to using Chaplin as scaffold and that is its tight integration with Facebook. It makes sense because Moviepilot Chaplin is a Facebook app! The thing that made backbone.js so easy to learn was simple apps like the Todo list. I was trying to integrate Chaplin with my existing backbone app, but I don't need Facebook integration or client side authentication. I am not criticizing the architecture of Chaplin at all, because as you said it is a sample from which we can write our own apps. But, I find that I can't continue until I set up server side opened and oauth authentication first. (Plus i have a small baby at home :-) ). I really want to see the popularity of Chaplin catch on, if only others could see how elegant it is. I've worked with other MVC frameworks that sit on backbone and none are as easy to learn as this one. Perhaps, if time allows you could publish a simple app that runs without Facebook integration. I think it would fuel a faster adoption of Chaplin.

Best regards, Chris

Sent from my iPad

On Mar 22, 2012, at 3:51 PM, Mathias Schäferreply@reply.github.com wrote:

That’s a pity. If it helps I can create a branch for you without all the client-side login stuff. Feel free to contact me directly via mathias.schaefer@9elements.com for further questions.


Reply to this email directly or view it on GitHub: https://github.com/moviepilot/chaplin/issues/11#issuecomment-4650162

molily commented 12 years ago

Here you are: https://github.com/moviepilot/chaplin/tree/no-login I’ve removed all login-related code, it’s just the bare scaffold with one controller. This controller performs a simple JSONP call to show some tweets of … Lady Gaga. No login required, just start the app and the tweets are loaded.

crussi commented 12 years ago

Thank you Mathias! I really appreciate it :-) ... This helps a lot ... I will download it and see how things are different and how I can apply it. I know in your documentation that you say server side opened and oauth is old school, but aren't you concerned about client side hacking? Don't get me wrong, I see the potential of single page applications and that is the direction I am going. And your Chaplin framework makes it that much better. Thanks again for this simple app!!!

Best regards, Chris

Sent from my iPad

On Mar 23, 2012, at 3:41 AM, Mathias Schäferreply@reply.github.com wrote:

Here you are: https://github.com/moviepilot/chaplin/tree/no-login I’ve removed all login-related code, it’s just the bare scaffold with one controller. This controller performs a simple JSONP call to show some tweets of … Lady Gaga. No login required, just start the app and the tweets are loaded.


Reply to this email directly or view it on GitHub: https://github.com/moviepilot/chaplin/issues/11#issuecomment-4656841