Comment on page
Add Facebook Login to an Ionic App. Learn how we integrated Facebook Authentication in Ion2FullApp Ionic Template to allow users to log in using Facebook Native App.
We have integrated the possibility to login and signup with Facebook app.
You can find all the code needed for this in:
After you have created you Facebook app it’s time to install the plugin into your app. Follow these steps to get this DONE:
- Execute the following command on the terminal changing the variables with your own values. Replace APP_ID and APP_NAME variables with your Facebook app values
$ ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication" --save
$ npm install --save @ionic-native/facebook
src/pages/facebook-login/facebook-login.service.tsset your APP_ID to the variable: FB_APP_ID
FB_APP_ID: number = 123456789;
src/pages/facebook-login/facebook-login.service.tsinside the method
doFacebookLogin()you will find the following line where you have to include the permissions you need.
["public_profile"]is the array of permissions, you can add more if you need.
When you go to Functionalities/Facebook Integration in the app you will see a screen with the data extracted from Facebook. Please note that in this example the friends and photos lists are populated with dummy data.