diff -r fcab5b06afb5 src/org/openbravo/mobile/core/login/MobileCoreLoginHandler.java
--- a/src/org/openbravo/mobile/core/login/MobileCoreLoginHandler.java	Fri Dec 22 09:46:18 2017 +0100
+++ b/src/org/openbravo/mobile/core/login/MobileCoreLoginHandler.java	Fri Jan 05 15:41:36 2018 +0100
@@ -164,7 +164,7 @@
 
         completeLogin(vars, userId, defaults);
 
-        vars.setSessionValue("#AD_Role_ID", role.getId());
+        vars.setSessionValue("#AD_Role_ID", defaults.role);
         session.setLoginStatus(getSessionType());
         session.setSessionActive(true);
 
@@ -173,7 +173,7 @@
         if (MobileServerUtils.isMultiServerEnabled()) {
           jsonMsg.put("authenticationToken", MobileAuthenticationKeyUtils
               .getEncryptedAuthenticationToken(OBContext.getOBContext().getCurrentClient().getId(),
-                  OBContext.getOBContext().getCurrentOrganization().getId(), userId, role.getId(),
+                  OBContext.getOBContext().getCurrentOrganization().getId(), userId, defaults.role,
                   (String) RequestContext.get().getSessionAttribute("POSTerminal")));
           jsonMsg.put("authenticationClient", defaults.client);
         }
