Switch branches/tags
Nothing to show
Find file History
Latest commit bba05d9 Sep 16, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
www update fb-login javascript Sep 15, 2016
README.md update fb-login readme Sep 15, 2016
api.R add fb-login app Jul 25, 2015
app.R some updates May 8, 2016


Facebook login through JavaScript in Shiny

This app shows how you can use the AJAX-like system in Shiny to authorize a user using Facebook's JavaScript library and pass the user's information to R for processing. You'll need to set up your app with proper settings on Facebook's Developer Dashboard (most importantly the app URL), and add your Facebook App ID as the appId parameter in the app.js file (in this line).

Here is the series of steps to get your app working locally as of September 2016:

  • Go to https://developers.facebook.com/apps
  • Click on + Add a New App and fill in the required info
  • When you get to the new app's Settings page, click on + Add Product
  • Select Facebook Login
  • In the field for Valid OAuth redirect URIs, type http://localhost:5000
  • Click Save Changes
  • When running your shiny app:
    • You'll need to run your Shiny app using port 5000 because that's the port we used in the Facebook settings (eg. runApp('fb-login', port = 5000))
    • You'll need to replace the in the URL with localhost (Facebook doesn't work with

When deploying an app on a shiny server or on shinyapps.io, you'll need to adjust the app settings acordingly.

Unfortunately these steps are not guaranteed to work forever - Facebook is known to change their API often, as well as the Developer Dashboard and all the available settings. I will not be maintaining this code to work with the ever-changing Facebook API, so if you're having problems setting up your app with the correct settings, just know that there are tons of other people also struggling with it, and use Google/Stackoverflow to try to figure it out :)