Sociogram is a sample application that demonstrates how to:
- Login with Facebook
- Request specific permissions
- Revoke permissions
- Get data (list of friends, mutual friends, feed items, etc.)
- Post to your feed
The application also demonstrates some cool Ionic features such as:
- Sliding Menu
- Pull-to-Refresh (in Feed)
- “Loading…” UI (while waiting for the feed to load)
Try it Here
Click here to run a hosted version of Sociogram and access your Facebook data. Resize your browser window and make it narrow to simulate the screen size of your phone.
The source code is available in this repository on GitHub.
To run the sample application on your own system:
- Create an Ionic project
- Add the inappbrowser plugin to your project
- Replace the www folder of the Ionic project with the www folder in this repository
- Create a Facebook app here: https://developers.facebook.com/apps. In the advanced settings, make sure you declare a “Valid OAuth redirect URI”. For example, if during development you access your application from http://localhost/openfb/index.html, you must declare http://localhost/openfb/oauthcallback.html as a valid redirect URI. Also add https://www.facebook.com/connect/login_success.html as a Valid OAuth redirect URI for access from Cordova.
- Copy the Facebook App Id and paste it as the first argument of OpenFB.init() in the run() function in app.js.
- To run the app in the browser: Load index.html from a location that matches the redirect URI you defined above. For example: http://localhost/openfb/index.html
- To run the app in Cordova: Build the Ionic project and run it as a Cordova app on your device
cordova plugins add org.apache.cordova.inappbrowser