Worklight: WL.Server.setActiveUser - Can't modify - Illegal State: Cannot change identity

前端 未结 1 1550
无人共我
无人共我 2020-12-20 02:53

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()         


        
相关标签:
1条回答
  • 2020-12-20 03:08
    1. Always supply a realm name in getActiveUser API, e.g. WL.Server.getActiveUser("myRealm")

    2. 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", {...})

    0 讨论(0)
提交回复
热议问题