I am trying to modify the logged in user identity,
var mydata=\"this is custom data array\";
var user = JSON.parse(JSON.stringify(WL.Server.getActiveUser()
Always supply a realm name in getActiveUser
API, e.g. WL.Server.getActiveUser("myRealm")
Just like error message says - you cannot alter active user identity, it is not mutable. What you need to do is to dispose of existing user identity first by invoking WL.Server.setActiveUser("myRealm", null)
and then call WL.Server.setActiveUser("myRealm", {...})