通过基于适配器的身份验证登录时移动优先平台 7.1 控制台中的设备用户映射

device user mapping in mobile first platform 7.1 console while log in through adapterbased auhentication

我正在尝试根据教程创建一个登录模块,并将在下一步中使用登录用户 ID 作为目标:sent_EventBased_Push_notification

https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/authentication-security/adapter-based-authentication/adapter-based-authentication-native-android-applications/

没有做任何更改,只是从 github 和 运行 下载了那些示例项目,然后在 mfp 和 android studio 中 is.And 他们确实工作得很好。

但是在 mobilefirst 控制台中,虽然我看到设备已注册,但没有针对它的用户 ID..我的意思是我正在使用 nexus4 登录和登录 ID 'my-phn-no'。所以用户 ID应该是 'my-phn-no'.

下面我正在粘贴我的 AuthAdapter-impl.js [与示例相同]

function onAuthRequired(headers, errorMessage){
   errorMessage = errorMessage ? errorMessage : null;

   return {
    authStatus: "credentialsRequired",
    errorMessage: errorMessage
};
}

function submitAuthentication(username, password){
if (username==="8907870678" && password === "password"){

    var userIdentity = {
            userId: username,
            displayName: username, 
            attributes: {
                foo: "bar"
            }
    };
    //WL.Server.sendMessage("Hello", "hi,gd mg")
    WL.Server.setActiveUser("AuthRealm", userIdentity);

    return { 
        authStatus: "complete" 
    };
    }

   return onAuthRequired(null, "Invalid login credentials");
  }

 function getSecretData(){
    return {
    secretData: "12345 changed for trial"
   };
  }

 function onLogout(){
    WL.Logger.debug("Logged out");
}

能否请您指出我是missing/how我实现的部分。提前谢谢你。

我在 SIT 环境中尝试了相同的代码,其中实际产品安装了 MFP 7.1。它工作得很好。 我想我的 eclipse 插件出了点问题。