Social Login (for ionic 3 app)
Read this document to avoid any mistake or conflict - https://github.com/EddyVerbruggen/cordova-plugin-googleplus
Uncommenting the code
I have commented on social login code because some people find it difficult to integrate. To add social login you have to install native plugins and uncomment the code
Uncomment Facebook and GooglePlus import in src/app/app.module.ts and src/pages/account/login/login.ts
Uncomment Facebook and GooglePlus in the providers section of src/app/app.module.ts
Add GooglePlus, Facebook constructor src/pages/account/login/login.ts file
Uncomment Social login in src/pages/account/login/login.ts file
Uncomment Social login buttons in src/pages/account/login/login.html file
Google Authentication
Get your credentials from Google.
Install the Google native plugin.
1. Get your credentials from Google.
Go to https://console.firebase.google.com and create a project.
Once project is added we need to create both ios and android app in firebase console https://console.firebase.google.com.
let’s start with the iOS one,
Choose your project. Click settings icon and then select project settings
Click on ADD APP and then choose a platform
It will ask you an iOS Bundle ID, to get it, go into your app’s config.xml file and copy the package id you’re using, it’s the one that looks like (id=”com.ionicframework.something”) from your config.xml file.
Click REGISTER APP. It will generate GoogleService-Info.plist file.
Click on Download GoogleService-Info.plist file, which is a config file for iOS.
After downloading GoogleService-Info.plist file click on Continue > Continue > FINISH
.
Copy GoogleService-Info.plist file to your project root directory.
You will get REVERSED_CLIENT_ID from the downloaded GoogleService-Info.plist file. REVERSED_CLIENT_ID is required while installing Google native plugin at the later stage.
Once we add iOS app, we need to add Android app.
Click ADD APP and choose android platform
It will ask you an Android Bundle ID, to get it, go into your app’s config.xml file and copy the package id you’re using, it’s the one that looks like (id=”com.ionicframework.something”) from your config.xml file.
Click REGISTER APP. It will generate google-services.json file
Click on Download google-services .json file, which is a config file for Android.
After downloading google-services.json file click on Continue > FINISH
Copy google-services.json file to your project root directory
You will get CLIENT_ID from the downloaded google-services.json file.
Add CLIENT_ID in src/providers/config.ts file
2. Install the GooglePlus Cordova Plugin.
We will get REVERSED_CLIENT_ID in GoogleService-Info.plist file
Run the following command to install GooglePlus Cordova plugin
Facebook Authentication
More detail - https://ionicframework.com/docs/native/facebook https://github.com/jeduan/cordova-plugin-facebook4
Make sure you've registered your Facebook app with Facebook and have an APP_ID
First, have to create a new Facebook App inside of the Facebook developer portal at https://developers.facebook.com/apps.
Retrieve the App ID
and App Name
2. Add android and ios platforms. Go to settings>basics as shown below and click +Add Platform.
3. Fill the required fields while adding android and ios platforms and save changes.
4. In the final step, Change the status of the app from development mode to Live.
Install the Cordova and Ionic Native plugins. where App ID
and App Name
are the values of the Facebook Developer portal.
You are done. Build Your App
Last updated