Migration approach to another service as Account Kit shut down

Photo by Robert Anasch on Unsplash

Facebook recently announced that AccountKit will shut down on March 9, 2020. At Better HR, we supported 2 login types: email + password login and phone login.

So, we need to find a solution to switch to another phone number verification service for phone login. But, we don’t want to switch to other service immediately as users will be affected if new service has some problems we didn’t notice.

We decided to make percentage rollout for new phone number verification services as we need to know whether new verification service is reliable or not.

Code snippets are for Android. But, the concepts may apply to other platforms, too.

The idea

Firebase Remote Config let developer change variables inside the app without needing an update.

Firebase A/B Testing helps to make user groups : Facebook Account Kit User and Other Service User ( used FirebaseAuth in this article ) in our case. It also has an option to divide users with percentage so let some percentage of users use Account Kit and other users use other service.

Code

Unified Interface for Phone Verification

And PhoneVerifierResult sealed class as verification result object.

Result class to be used after verificaton result

PhoneVerifier is just an abstraction. Concrete implementations can be added based on requirements.

2 implementations in our case : AccountKitPhoneVerifier and FirebaseAuthPhoneVerifier.

Implementation for Account Kit
Implementation for Firebase Auth

Now we created 2 implementations. We still need to consider which implementation will be used for which user.

Firebase Remote Config & A/B Testing

This is how we setup.

2 user groups

2 user groups are created. So, value of “android_phone_auth” will be set “accountkit” to 50% of users and “firebase” to other half.

In the app, we need to consider which phone verifier should be used. So, check firebase remote config value if user clicked “Login with Phone”.

LoginActivity.kt

PhoneVerifier will be set up based on config value and related Activity will be shown based on it.

onActivityResult and onDestroy

Check result at onActivityResult and clear stuffs by calling onDestroy.

And. That’s it. Now, we can wait and figure out whether new service works well for users and can switch to another service if it doesn’t work.

An abstraction + Remote Config + A/B Testing do the magic.

Happy Migration.

Lead Mobile Developer @ better.hr || product || ui/ux || software architecture || https://lin.phyo.work

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store