How to maintain session in appzillon 3.5.12

Kindly share us the process for maintaining session in appzillon 3.5.12 version with JS code. Also, let us know how is the relogin function used during login into the session (the arguments to be passed for th relogin function) with sniplet code.

Kindly revert us at the earliest.

Thank You.
Session maintenance is done by Appzillon , by default and developers are not expected to create sessions using JS Code. Appzillon uses HTTP session ( Cookie based) on Web Container and Web Container uses a token exchange ( Access Token) mechanism with Appzillon Server. Please let us know in case you are looking for any specific use case/functionality and we can address the same if need be.

Appzillon's login API ( apz.Server.login) is by default re-login and kills any existing user sessions if exists. Please find below the code snippet to call relogin

apz.app.login = function() {
var userId = apz.getElmValue(apz.appId + '__Login__userId');
var password = apz.getElmValue(apz. appId + '__Login__pswd');
if (apz.isNull(userId) || apz.isNull(password)) {
var params = {
'code': 'APZ-LOG-ERR'
};
apz.dispMsg(params);
} else {
apz.startLoader();
var req = {};
req.userId = userId;
req.pwd = password;
req.scrsAccessType = 'A';
req.ifacesAccessType = 'A';
req.controlsAccessType = 'A';
req.callBack = apz.app.LgCB;
apz.server.login(req);
}
};
Sir in my case, i am using micro app, where the user needs to set his/her password. For this i am using appzillonCreateUser (internal interface) for encrypting the password and maintaining a session.

But, the issue i am facing is that while i am using appzillonCreateUser for the mentioned above purpose, i am getting valid session does not exist error.

Please guide.

Thank You.
Hi saibharadwaj,

If I understand it right hope you are trying to register the user by himself/herself post which he/she will be able to use the same credentials to login and use the application.

Kindly use "appzillonUserRegistration" internal interfaceId for the above said case.
"appzillonCreateUser" is another internal interface which is widely used by Admin application for user creation.
Below is the request JSON structure

{
"appzillonBody": {
"appzillonUserRegistrationRequest": {
"smsRequiredPhone1": "Y",
"smsRequiredPhone2": "N",
"ussdRequired": "Y",
"profilePic": "",
"appId": "Admin",
"Devices": [
{
"deviceName": "new Device",
"status": "ACTIVE",
"deviceId": "device1"
}
],
"phone2": "",
"extIdentifier": "",
"email1": "user@abcd.com",
"password": "pin@1231",
"phone1": "999998888",
"email2": "",
"addr1": "adr1",
"addr2": "",
"addr3": "",
"addr4": "",
"roles": [

],
"userId": "userid",
"userStatus": {
"loginTime": "",
"loginStatus": "",
"userLocked": ""
},
"userName": "username",
"language": "en",
"secondarySmsRequired": "N",
"addInfo1": "",
"addInfo2": "",
"addInfo3": "",
"addInfo4": "",
"addInfo5": ""
}
},
"appzillonHeader": {
"appId": "Admin",
"deviceId": "WEB",
"sessionId": "MKyH1lzXeGPrwcesS0leWS2SV882i2Yj",
"userId": "userid",
"status": true,
"requestKey": "0.3884210642462841",
"interfaceId": "appzillonUserRegistration",
"screenId": ""
}
}



Thanks,
Arthanarisamy
Sir in my case, i am using micro app, where the user needs to set his/her password. For this i am using appzillonCreateUser (internal interface) for encrypting the password and maintaining a session.

But, the issue i am facing is that while i am using appzillonCreateUser for the mentioned above purpose, i am getting valid session does not exist error.

Please guide.

Thank You.
Sir,

As said, I have used appzillonUserRegistration internal interface and tried. But, it is popping error: "Password is not allowed to set by user".

How can we encrypt the password and set the session without giving the password.

Please guide.

Thank You.
Hi saibharadwaj


Set Allow user entered password value to 'Y' under application's security parameter details using Appzillon's Admin module or directly update column ALLOW_USER_PASSWORD_ENTRY to 'Y' and use the same user registration interface it should work.

Thanks,
Arthanarisamy
Sir,

For fresh registration, your suggestion of using appzillonUserRegistration internal interface is working. But, we are also giving an option for forgot password. When clicking on forgot password, we also following the same flow as the user registration. In this case, it is popping error: user id already exists because, the user entry is inserted into the asmiUser table while registration. So, please guide us how can we provide service of forgot password.
Sir,

Awaiting for your reply.
Hi saibharadwaj,

In case of forgot password, you should use appzillonForgotPassword interface instead of createUser.
appzillonForgotPassword interface request JSON is as defined below for your reference.

Interface appzillonForgotPassword, let you validate against user's primary mobileNo or primary email address and lets your change the password. Those validation parameters can be set using AppzillonAdmin's Security Parameter screen.

Code: Select all

{
  "appzillonHeader": {
    "screenId": "Landing",
    "requestKey": "0.5384884205393224",
    "appId": "Admin",
    "requestID": "dummy",
    "interfaceId": "appzillonForgotPassword",
    "status": true,
    "sessionId": "sKrXsaZHqlzm0xJf9GbFgm5jyxv6dBij",
    "userId": "admin",
    "source": "",
    "longitude": "324141",
    "latitude": "142414",
    "async": "false",
    "deviceId": "WEB"
  },
  "appzillonBody": {
    "appzillonForgotPasswordRequest": {
      "userId": "TestUser",
      "appId": "Admin",
      "email1": "email.a@i-exceed.com",
      "phone1": "99812341122",
      "password": "DVUnkr1d0qqpPHP5wjZVTg=="
    }
  }
}