Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook development in localhost

Just wanted to know if there is any way I could develop Facebook applications in localhost.

like image 387
Abhishek Avatar asked Dec 26 '10 04:12

Abhishek


People also ask

How do I stop enforce https on Facebook Developer?

This setting is in the Products > Facebook Login > Settings section of the App Dashboard. Disable this setting if you are not building a custom web login flow or using the Facebook Login SDK on the web. Enforce HTTPS.

How do I set up OAuth on Facebook?

In the App Dashboard, choose your app and scroll to Add a Product Click Set Up in the Facebook Login card. Select Settings in the left side navigation panel and under Client OAuth Settings, enter your redirect URL in the Valid OAuth Redirect URIs field for successful authorization.


2 Answers

Of course you can, just add the url localhost (without "http") in your app_domain and then add in your site_url http://localhost (with http)

Update

Facebook change the things a little now, just go to the app settings and in the site url just add http: //localhost and leave the App Domain empty

like image 27
stalin Avatar answered Sep 27 '22 03:09

stalin


Edit: 2-15-2012 This is how to use FB authentication for a localhost website.

I find it more scalable and convenient to set up a second Facebook app. If I'm building MyApp, then I'll make a second one called MyApp-dev.

  • Create a new app at https://developers.facebook.com/apps
  • (New 2/15/2012) Click the Website checkbox under 'Select how your application integrates with Facebook' (In the recent Facebook version you can find this under Settings > Basic > Add Platform - Then select website)
  • Set the Site URL field (NOT the App Domains field) to http://www.localhost:3000 (this address is for Ruby on Rails, change as needed)

enter image description here

  • In your application initializer, put in code to detect the environment
    • Sample Rails 3 code
       if Rails.env == 'development' || Rails.env == 'test'   Rails.application.config.middleware.use OmniAuth::Builder do     provider :facebook, 'DEV_APP_ID', 'DEV_APP_SECRET'   end else   # Production   Rails.application.config.middleware.use OmniAuth::Builder do     provider :facebook, 'PRODUCTION_APP_ID', 'PRODUCTION_APP_SECRET'   end end 

I prefer this method because once it's set up, coworkers and other machines don't have additional setup.

like image 120
Eric Hu Avatar answered Sep 26 '22 03:09

Eric Hu