• No replies
570 Posts

Pinned topic Adapter-based authenticator failed with onStartup

‏2012-06-01T04:57:30Z |

I have an error during get/set userPref using adapter-based authenticator.
Version 1, my app uses onDemand, the main menu page open, and a ping-purpose request called, it request a protected function, and triggers authRequired = true, then client side goes to login page, after login, close login page and return back to main menu.
this works fine.

Version 2, Now, user request to use onStartup authentication, my Authenicator javascript object can process login process correctly, but it cannot access WL.Client.s/getUserPref and WL.Client.getUserInfo, and getAppProp("WORKLIGHT_ROOT_URL"). it seems that at this moment, WL.Client.userPrefs/userInfo/gadgetProps are all empty hash. Then i'm not sure what's correct moment I call getUserPref/setUserPref, I can avoid trying getUserPref before login page shown completely, but when I try to invokeProcedure for login purpose during clicking 'Login' button, it raises NullPointerException at the following call stack trace:

getAppProp() at wlclient.js:1099 with parameter "WORKLIGHT_ROOT_URL"
getAppProperty() at wlclient.js:2026
createAPIRequestURL() at worklight.js:418
Ajax.WLRequest.Class.create.initialize() at worklight.js:973
klass() at prototype.js:106
invokeProcedure() at wlclient.js:2207
login() at ingenium.js:111
login() at auth.js:57
responder() at prototype.js:5603

the error says, cannot read property "WORKLIGHT_ROOT_URL" of undefined, I checked
WL.Client.gadgetProps, during my Authenticator interaction, WL.Client.gadgetProps is an empty hash (var this refer to WL.Client), but during click 'Login' button to invokeProcedure, it is undefined (var this refer to DOMWindow).

Anybody get same errors or solutions?

My worklight server is, worklight studio and server are download at same moment.