Cordova platform sign up and log in through native Facebook and apps challenge

17 September 2017
Preview gurov
Andrey Gurov
Project Manager

User registration and signing in is the foundation almost for every contemporary mobile (and not only for mobile) apps. Pre-installed official social mobile apps is an easiest way for user to register and sign in because he doesn’t have to fill form fields manually.

Regarding implementation technology to signing in you can apply either universal Oauth-libraries or an official social media SDK. The official SDK has an important advantage, they conduct authorization through pre-installed apps and operation system account settings. Due to SDK we can ask for more information about the user including a list of friends or interests and display relevant information in the app.

Unfortunately, this works only for native apps. In our case, there wasn’t ready-made solution for Cordova. Available SDK plugin wrappers looks slightly unfinished and unreliable. The most prominent Cordova plugin refused to be assembled.

Our goal

Create app authorizations through native SDK supplier and then transfer access token to the backend to pass the verification in it. By simple words, we need backend authorization by token received through the social native app. If the app transfer wrong token, social media will not provide data, thereafter authorization will not take place.

Schematic solution

Finally, we applied parts of the following plugins and implemented the above interaction scheme.

Here is an issue solution

Further, depending on the version used (mobile app or website) occurs authorization choice of the strategy. The first case was described above and in other case custom devices oauth proceeds.

Which parameters are required to be set up this interaction?

VKontakte authorisation

Go to the developer section and create new standalone app

You will need a key, service token and switched-on Open API.

Important parameters for plugin settings are App Bundle ID, AppID for iOS and Package name for Android and Signing certificate fingerprint.

Don’t forget to add an App signing certificate fingerprint key from Google Play.

Authorizing through Facebook

You should add necessary settings for a platform authorization. For iOS you should specify assembly id and id of the app in App Store which you can find in iTunes connect.

For Android, you should specify a key hash-address and package name from Google Play.

Don’t forget to make the app available for all users.

A happy end of the research can be tested in the application Two Capitals, which was developed by us and is available in both AppStore and Google Play. Registration and logging in process through native Vkontakte and Facebook apps takes less than 10 seconds for the user without need to remember and enter the username and password for those social networks. We wish successful integrations!