React Native authentication guide

Setup Application ID

This will guide to setup your APP-ID in your project.Your App ID can be found here [App ID](install


In your app android manifest file find the below metadata and put your APP-ID in value

<meta-data android:name="com.applozic.application.key"
           android:value="<YOUR_APPLOZIC_APP_ID>" />


Open the ALChatManager.h and and Replace "applozic-sample-app" with your APP-ID.



Define the native module.

var ApplozicChat = NativeModules.ApplozicChat;

Creating a User object

A User object needs to be initialised and then authenticated to use Applozic's features. A user object has a unique field userId which is also the only mandatory field. You can create a User object as below:

var alUser = {
            'userId' : userId,   //Replace it with the userId of the logged in user NOTE : userId need to be string and  +,*,? are not allowed chars in userId.
            'password' : password,  //Put password here
            'authenticationTypeId' : 1,
                     'displayName': DISPLAY-NAMEOF-USER

Registering/Logging-in the user



Please remember you have to log in once and only after you log out you must log in again. Use below code to check if the user is already logged in.

You can check if user is logged in to applozic or not by using:

ApplozicChat.isUserLogIn((response) => {
                if (response == "true") {
                  /// User is logged in already
                } else {
                  /// User is not logged in yet.

You can authenticate the user with Applozic using the below methods. If the login request is from a new user then a new user account is created. If the user is an existing user then user authentication details are validated by the server.

ApplozicChat.login( alUser , (error, response) => {
                     //authentication failed callback
                    //authentication success callback 

What’s Next
Did this page help you?