I try to connect Facbook Account Kit in Ionic/cordova App, main problem i faced that in facebook account kit set client/server side domain name but in ionic/cordova app the webview serve from file system("file:///android_asset/www/index.html#/app/request"). So how to do this in Ionic app.
ionic cordova plugin add cordova-plugin-facebook-connect --variable APP_ID="123456789" --variable APP_NAME="myApplication" After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings: Click 'Add Platform'.
After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings: Click 'Add Platform'. At this point you'll need to open your project's config.xml file, found in the root directory of your project.
Whether your app is in its conceptual stages or already established, Account Kit can help you grow by giving people more ways to log in. Saavn, a music streaming app, saw over half a million registered phone number users and a 33% increase in daily new registrants within the first two months after integrating Account Kit phone number login.
Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android. Requires Cordova plugin: cordova-plugin-facebook-connect. For more info, please see the Facebook Connect.
You can use plugin instead of webview https://github.com/gurisko/cordova-plugin-accountkit
Steps:
cordova plugin add cordova-plugin-accountkit --save --variable APP_ID="123456789" --variable APP_NAME="myApplication" --variable CLIENT_TOKEN="abcdefghijklmnopqrstuvwxyz"
AccountKitPlugin.loginWithPhoneNumber({
useAccessToken: true,
defaultCountryCode: "US",
},function(res){
console.log(res)
},function(err){
console.log(err)
})
Incase of Ionic with typescript just add (window) before function
(<any>window).AccountKitPlugin.loginWithPhoneNumber({
useAccessToken: true,
defaultCountryCode: "US",
},function(res){
console.log(res)
},function(err){
console.log(err)
})
Reference: https://codesundar.com/ionic-accountkit-integration/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With