Ionic 3 – Phone Auth with Accountkit

Hi Friends,

Hope you are all well. In this post, let’s talk about authentication in your ionic apps using just a phone number. For this post we’ll be using accountkit through the facebook developer portal.

Let’s begin.

A video screencast of this post.

 

First visit Facebook Developer Portal and create a new app. (Kindly watch the video to get more clarity on this).

Now that you have the app id, app name and client token, install the cordova-plugin-accountkit using the below command.

This plugin will help us a lot in authenticating our app. Now that you have installed it, let’s create two pages namely login and dashboard page.

Open up app.component.ts file and change the root page to our LoginPage.

Now open up login.html and add the below code.

Open up login.ts and add the below code.

That’s it now we could login with our mobile number simply into our app.

Run the app on a device. If you get an error simply follow the below steps.

Open up platforms -> android -> app -> src -> main -> res -> strings.xml

In this file add the below lines of code inside <resources> block

This would fix the error (This is a quick fix and should be used only when you get an error).

Hope this helped you guys. If you found this helpful, kindly share it with someone and help them too.

Thanks for reading, Peace.. :)

 

Liked it? Take a second to support admin on Patreon!
  • Abel

    hello, can you loadup the open source code for this

  • sunil kunapareddy

    its says loginWithPhoneNumber is undefined dude in console… plz rectify this error

  • chamundeswari reddy

    hello, how to change UI in this accountkit phone authentication