Authentication 是否有我可以使用WL.Server.SetActiveUser的特定范围?

Authentication 是否有我可以使用WL.Server.SetActiveUser的特定范围?,authentication,ibm-mobilefirst,Authentication,Ibm Mobilefirst,我正在尝试在Worklight中创建基于适配器的身份验证。我已将我的领域、安全测试和登录模块添加到authenticationConfig文件中。我试着跟随IBM提供的模块。我复制了WL.Server.setActiveUser方法的确切语法,甚至是硬编码值。但我还是继续得到一个错误。我是否可以在一定范围内使用此方法?有人看到或知道我的错误在哪里吗 我继续得到以下错误: LOG: Request [login] LOG: Request [/apps/services/api/GPC2/and

我正在尝试在Worklight中创建基于适配器的身份验证。我已将我的领域、安全测试和登录模块添加到authenticationConfig文件中。我试着跟随IBM提供的模块。我复制了WL.Server.setActiveUser方法的确切语法,甚至是硬编码值。但我还是继续得到一个错误。我是否可以在一定范围内使用此方法?有人看到或知道我的错误在哪里吗

我继续得到以下错误:

LOG: Request [login] 
LOG: Request [/apps/services/api/GPC2/android/query] 
LOG: response [/apps/services/api/GPC2/android/query] success: /*-secure-
{"responseID":"1","isSuccessful":true,"resultSet REMOVED LINE THAT CONTAINED DB RESULTS FOR     SECURITY
[/apps/services/api/GPC2/android/query] exception. 
SCRIPT5007: Unable to get value of the property 'setActiveUser': object is null or undefined 

var lname= responseData.invocationResult.resultSet[0].somelastname;
var gpcid = responseData.invocationResult.resultSet[0].someid;
var fname = responseData.invocationResult.resultSet[0].somefname;
WL.Logger.debug("Login :: SUCCESS" + lname + " " + gpcid + " " + fname);  //this line does write the values to the log

//WL.Client.login("NotificationsRealm");
WL.Server.setActiveUser ("NotificationsRealm", {
userId: gpcid,
displayName: fname,
attributes: {
firstName: fname,
lastName : lname,
isUserAuthenticated: 1,
}
});
看这个,应该是这样的:

WL.Server.setActiveUser ("ACMERealm", {
    userId: "38017840288",
    displayName: "John Doe",
    attributes: {
        "firstName": "John",
        "lastName": "Doe",
        "lastLogin": "2010-07-13 19:25:08.0 GMT",
    }
})

看起来您缺少属性的双引号了?

我用一个硬编码字符串尝试了一下,但也不起作用。Srings被javascript变量替换,以便可以从SQL适配器动态填充名称;你试过这个例子吗?伊丹,谢谢你的回答。是的,我试过了。我相信我已经发现了我的问题。代码中的其他地方有语法错误,导致了问题。