diff --git a/javascript/src/iframe/viamapi-iframe.js b/javascript/src/iframe/viamapi-iframe.js
index 9ea1e720e9791d99c492a445f6db10cdcb2fa027..443640ff94bd8b932037770ca3d53a4d1ceef6db 100644
--- a/javascript/src/iframe/viamapi-iframe.js
+++ b/javascript/src/iframe/viamapi-iframe.js
@@ -1353,7 +1353,7 @@ const handleIdentityLogin = async (identity, uuid, token) => {
 
     const deviceHash = await createDeviceHash(publicKey);
 
-    viamApi.setSessionData(uuid, token);
+    viamApi.setSessionData(uuid, token, deviceHash, navigator.userAgent);
     localStorage.setItem("uuid", uuid);
     localStorage.setItem("token", token);
     localStorage.setItem("authenticatedIdentity", publicKey);
@@ -1375,11 +1375,11 @@ function executeRestfulFunction(type, that, fn, ...args) {
 
       if (type === "private" && identity && response.data.code === "400" && response.data.status === "Bad session") {
         viamApi.identityLogin("previousaddeddevice")
-          .then((response) => {
+          .then(async (response) => {
             if (response.data.code === "200") {
               const uuid = response.data.data["Uuid"];
               const token = response.data.data["Session"];
-              handleIdentityLogin(identity, uuid, token);
+              await handleIdentityLogin(identity, uuid, token);
               // TODO: Previously there was fn.apply(null, args) where null is probably wrong context for fn.apply()
               fn.apply(that, args).then(({data}) => executeResult(data));
             } else {
@@ -1399,7 +1399,7 @@ window.executeRestfulFunction = executeRestfulFunction;
 function loadIdentityInternal(identityKey, pinCode) {
   return new Penpal.Promise(result => {
     console.log("Loading identity with pincode: " + pinCode);
-    getIdentityFromLocalStorage(identityKey, pinCode).then((loadedIdentity) => {
+    getIdentityFromLocalStorage(identityKey, pinCode).then(async (loadedIdentity) => {
       if (loadedIdentity == null) {
         result({
           "data": "",
@@ -1415,7 +1415,8 @@ function loadIdentityInternal(identityKey, pinCode) {
         window.viamApi.setIdentity(identityKey);
         const uuid = localStorage.getItem("uuid");
         const token = localStorage.getItem("token");
-        window.viamApi.setSessionData(uuid, token);
+        const deviceHash = await createDeviceHash(identityKey);
+        window.viamApi.setSessionData(uuid, token, deviceHash, navigator.userAgent);
       }
 
       //console.log("Set loaded identity in load identity")
@@ -1728,7 +1729,7 @@ const connection = Penpal.connectToParent({
 
         viamApi.setIdentity(loginIdentity.authentication.publicKey);
 
-        executeRestfulFunction("public", viamApi, viamApi.identityLogin, mode, code, actionID).then(executeResult => {
+        executeRestfulFunction("public", viamApi, viamApi.identityLogin, mode, code, actionID).then(async executeResult => {
           // console.log(executeResult)
           //console.log(mode)
           switch (mode) {
@@ -1736,7 +1737,7 @@ const connection = Penpal.connectToParent({
               if (executeResult.code === "200") {
                 const uuid = executeResult.data["Uuid"];
                 const token = executeResult.data["Session"];
-                handleIdentityLogin(loginIdentity, uuid, token);
+                await handleIdentityLogin(loginIdentity, uuid, token);
                 delete executeResult.data["Uuid"];
                 delete executeResult.data["Session"];
                 getProfileData(loginIdentity).then(executeResult1 => {
@@ -1752,7 +1753,7 @@ const connection = Penpal.connectToParent({
               if (executeResult.code === "200") {
                 const uuid = executeResult.data["Uuid"];
                 const token = executeResult.data["Session"];
-                handleIdentityLogin(loginIdentity, uuid, token);
+                await handleIdentityLogin(loginIdentity, uuid, token);
                 delete executeResult.data["Uuid"];
                 delete executeResult.data["Session"];
                 getProfileData(loginIdentity).then(executeResult1 => {
@@ -1882,7 +1883,7 @@ const connection = Penpal.connectToParent({
       return new Penpal.Promise(result => {
         executeRestfulFunction("private", viamApi, viamApi.identityLogout).then(executeResult => {
           viamApi.setIdentity("");
-          viamApi.setSessionData("", "");
+          viamApi.setSessionData("", "", "", "");
           clearPinCodeTtl(authenticationPublicKey);
 
           window.authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
@@ -2161,7 +2162,7 @@ const connection = Penpal.connectToParent({
 
         executeRestfulFunction("public", viamApi, viamApi.marketingSignUpIdentificator, identificator, reference).then(executeResult => {
           viamApi.setIdentity("");
-          viamApi.setSessionData("", "");
+          viamApi.setSessionData("", "", "", "");
           result(executeResult);
         });
       });
@@ -2172,7 +2173,7 @@ const connection = Penpal.connectToParent({
 
         executeRestfulFunction("public", viamApi, viamApi.marketingGetIdentificatorProfile, identificator, pincode).then(executeResult => {
           viamApi.setIdentity("");
-          viamApi.setSessionData("", "");
+          viamApi.setSessionData("", "", "", "");
           result(executeResult);
         });
       });
@@ -2183,7 +2184,7 @@ const connection = Penpal.connectToParent({
 
         executeRestfulFunction("public", viamApi, viamApi.marketingExecuteEventForIdentificator, identificator, pincode, event).then(executeResult => {
           viamApi.setIdentity("");
-          viamApi.setSessionData("", "");
+          viamApi.setSessionData("", "", "", "");
           result(executeResult);
         });
       });
@@ -2402,7 +2403,7 @@ connection.promise.then(parent => {
 
     if (window.currentlyLoadedIdentity != null && anynomousDeviceKeyEventsProcessing === false) {
       anynomousDeviceKeyEventsProcessing = true;
-      executeRestfulFunction("public", viamAnonymousApi, viamAnonymousApi.eventGetNewEventsWithoutSession, "devicekey").then(executeResult => {
+      executeRestfulFunction("public", viamAnonymousApi, viamAnonymousApi.eventGetNewEventsWithoutSession, "devicekey").then(async executeResult => {
         if(executeResult.code === "200") {
           var eventsLen = executeResult.data.length;
           let changedMaxDeviceKeyAnonymousEventTime = false;
@@ -2414,7 +2415,7 @@ connection.promise.then(parent => {
                 console.log("Sending authenticated event");
                 const uuid = event.payloads[0];
                 const token = event.payloads[1];
-                handleIdentityLogin(window.currentlyLoadedIdentity, uuid, token);
+                await handleIdentityLogin(window.currentlyLoadedIdentity, uuid, token);
                 const identityToStore = window.currentlyAuthenticatedIdentity;
                 event.payloads = [{fromQRCode: true}];
                 console.log(identityToStore);
diff --git a/javascript/src/iframe/wopiapi-iframe.js b/javascript/src/iframe/wopiapi-iframe.js
index d1a10ff9abccd5340dd86b0fac317ce977b642f6..bb3b66446ede955839e38528035035f962a4ae5b 100644
--- a/javascript/src/iframe/wopiapi-iframe.js
+++ b/javascript/src/iframe/wopiapi-iframe.js
@@ -2,21 +2,21 @@ const axios = require('axios');
 
 function WopiAPI() {}
 
-WopiAPI.prototype.getPassports = function(fileID) {
+WopiAPI.prototype.getPassports = function (fileID) {
   const requestConfig = {
     headers: {
-      'publicKey': viamApi.getConfig().headers.publicKey,
-      'uuid': viamApi.getConfig().headers.uuid,
-      'token': viamApi.getConfig().headers.token,
-      'fileID': fileID
+      publicKey: window.viamApi.getConfig().headers.publicKey,
+      uuid: window.viamApi.getConfig().headers.uuid,
+      token: window.viamApi.getConfig().headers.token,
+      deviceHash: window.viamApi.getConfig().headers.deviceHash,
+      userAgent: window.viamApi.getConfig().headers.userAgent,
+      fileID
     }
   };
 
   const [protocol, host] = window.API_HOST.split(':');
 
   const url = `${protocol}${host}${window.WOPI_URI_PREFIX}/getPassports`;
-  // TODO: remove console log
-  console.log('Wopi', url);
   return axios.post(url, {}, requestConfig);
 };
 
diff --git a/main.go b/main.go
index 49dbcddc017c5f667fcc55771f59f05c3727cf20..cc9cd0802f88ab2b59a16d44163e13966f40afd5 100644
--- a/main.go
+++ b/main.go
@@ -73,18 +73,23 @@ func buildViamAPI() string {
 		"        headers: {\n" +
 		"            'publicKey': '',\n" +
 		"            'uuid': '',\n" +
+		"            'deviceHash': '',\n" +
+		"            'userAgent': '',\n" +
 		"            'token': ''\n" +
 		"        }\n" +
 		"    }\n" +
 		"}\n\n"
 
-	result += "ViamAPI.prototype.setSessionData = function(uuid, token) {\n" +
-		"    this.config.headers.uuid = \" \" + uuid;\n" +
-		"    this.config.headers.token = \" \" + token;\n" +
+
+	result += "ViamAPI.prototype.setSessionData = function(uuid, token, deviceHash, userAgent) {\n" +
+		"    this.config.headers.uuid = uuid;\n" +
+		"    this.config.headers.token = token;\n" +
+		"    this.config.headers.deviceHash = deviceHash;\n" +
+		"    this.config.headers.userAgent = userAgent;\n" +
 		"};\n\n"
 
 	result += "ViamAPI.prototype.setIdentity = function(authenticationPublicKey) {\n" +
-		"    this.config.headers.publicKey = \" \" + window.btoa(authenticationPublicKey);\n" +
+		"    this.config.headers.publicKey = window.btoa(authenticationPublicKey);\n" +
 		"};\n\n"
 
 	result += "ViamAPI.prototype.getConfig = function() {\n" +