Ibm mobilefirst WL.Client.getLoginName(“SingleStepAuthRealm”)未进入客户端
我在混合应用程序中使用基于适配器的身份验证 这是我的适配器代码Ibm mobilefirst WL.Client.getLoginName(“SingleStepAuthRealm”)未进入客户端,ibm-mobilefirst,worklight-server,worklight-studio,worklight-security,Ibm Mobilefirst,Worklight Server,Worklight Studio,Worklight Security,我在混合应用程序中使用基于适配器的身份验证 这是我的适配器代码 function submitAuthentication(username, password){ WL.Logger.warn("Start intial---------------------"); var input = { method : 'post', returnedContentType : 'json', path :
function submitAuthentication(username, password){
WL.Logger.warn("Start intial---------------------");
var input = {
method : 'post',
returnedContentType : 'json',
path : <path>,
parameters : {
<username> : username,
<password> : password,
}
};
var authResult = WL.Server.invokeHttp(input);
if(authResult.statusCode==200){
WL.Logger.warn("Start-----------user id="+authResult.id);
var userIdentity = {
userId: authResult.id+"",
displayName: username,
isUserAuthenticated:1,
attributes: {
"firstName": authResult.firstName,
"email": authResult.email,
"role": authResult.authorities[0].authority,
},
};
WL.Server.setActiveUser("SingleStepAuthRealm", null);
WL.Server.setActiveUser("SingleStepAuthRealm", userIdentity);
return {
authRequired: false
};
}else{
return onAuthRequired(null, "Invalid login credentials");
}
return authResult;
}
对此有何想法?您使用的是哪个版本的Worklight?在您的日志中,您能否确认身份验证成功?当您调用getLoginName时会发生什么?另外,尝试getUserInfo并查看您也得到了什么-在什么时候尝试调用getLoginName?您确定登录过程已完成吗?请用所有这些信息更新您的问题,而不是在这里回答
WL.Client.getLoginName("SingleStepAuthRealm")