So far, you have been just configuring the apps. This recipe will explain how easy it is to write the code to authenticate a user via Facebook, Twitter, or Google. You will go through an example app to set up a login button. The user will click on login to authenticate via his or her social network. Then, the app will display the basic profile information, including the user's picture. Finally, the user can click on logout to end the session.
The following instructions are used to code for the Facebook authentication:
Create a blank Ionic app (for example,
SocialAuth
), as follows:$ ionic start SocialAuth blank
Go to the project folder:
$ cd SocialAuth
For authentication to work on a physical device, it will need two Cordova plugins,
InAppBrowser
andCookies
. The reason is that the authentication popup window will...