Android: Implementing Email Verification with Facebook Account Kit

This is the second article in this series on Implementing Phone Number Verification With Facebook Account Kit.

Tobiloba Adejumo
Tobiloba Adejumo

Welcome to Part 2!

Hi! In this article, we will implement email verification with Facebook Account Kit.

💡 Tip: This is the second article in this series on Implementing Phone Number Verification With Facebook Account Kit. This is Part 1:

Android: Implementing Phone Number Verification with Facebook Account Kit
‌If you want to learn how to implement phone number verification with Facebook Account Kit, then this short article is for you. Let’s get started!

Email Verification

STEPS

  1. Enable “Allow Email Login” on your AccountKitVerification application on Facebook. In AccountKitVerification application, navigate to “AccountKit → Settings” to enable email login.

2. Enable Deep Linking on Android Studio. Deep linking makes it possible for your application to be launched automatically when a URL is clicked. When the verification link is sent to your email and if the link is valid, it automatically launches your application and passes data from the URL to the application. This is also known as Query Params; set of parameters attached to the end of a URL. Add intent-filters to manifest file to handle the verification URL. The intent filter contains a data tag that takes the android:scheme attribute. We need to define the string for it by appending “ak” to the app_id.

<string name="ak_login_protocol_scheme">akapp_id</string>

Then, we define the intent filter and the following to the manifest file.

<activity android:name="com.facebook.accountkit.ui.AccountKitEmailRedirectActivity">   <intent-filter>     <action android:name="android.intent.action.VIEW" />     <category android:name="android.intent.category.DEFAULT" />     <category android:name="android.intent.category.BROWSABLE" />     <data android:scheme="@string/ak_login_protocol_scheme" />  </intent-filter></activity>

via GIPHY

Finally, we are almost done! Aren’t you excited? :)

Let’s modify our onLogin() method call in onCreate() method from onLogin(LoginType.PHONE) to onLogin(LoginType.Email);

Finally go to onLogin() method definition and replace:

AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder = new AccountKitConfiguration.AccountKitConfigurationBuilder(LoginType.PHONE,AccountKitActivity.ResponseType.TOKEN);

with:

AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder = new AccountKitConfiguration.AccountKitConfigurationBuilder(LoginType.EMAIL,AccountKitActivity.ResponseType.TOKEN);
💻 Android

Tobiloba Adejumo

Doctoral Student, Research Assistant at The University of Illinois Chicago | Biomedical Optics and Functional Imaging Lab