无法连接到 MobileFirst Server 8 beta
Unable to connect to MobileFirst Server 8 beta
我正在使用 ionic with mobilefirst 项目。当我首先尝试将 ionic App 与移动设备集成时,mobilefirst 服务器未与我的应用程序连接,在服务器控制台中我没有获得有关我的应用程序的任何信息。
配置:
- 移动优先:8.0.0
- 科尔多瓦:6.1.1
- android: 5.1.1
要让 MobileFirst Server 识别您的应用程序,第一步是注册应用程序。您可以通过两种方式执行此操作:
使用 MobileFirst CLI
- 确保安装了 CLI
- 导航到应用程序项目的根文件夹
- 运行 命令:
mfpdev app register
直接从 MobileFirst 控制台。
此步骤将要求您手动输入申请的详细信息
- 加载控制台,通常是 localhost:9080/mfpconsole(如果 运行 服务器在本地)
- 在边栏导航中的 "Applications" 旁边,点击 "New"
- 提供应用详情:
- 姓名
- 平台
- bundle ID 和版本(您可以在应用程序项目的 config.xml 文件中找到它们
下一步实际上是让应用程序向服务器发送请求以查看连接是否成功...
通过运行命令添加SDK:cordova plugin add cordova-plugin-mfp
打开应用程序的 index.js 文件并添加以下代码(仅作为示例):
function wlCommonInit() {
WLAuthorizationManager.obtainAccessToken().then(
function () {
alert ("successfully obtained a token from the server");
},
function(response) {
alert("Unable to obtain a token from the server: " + JSON.stringify(response));
}
);
}
看看这个 Ionic 示例:https://github.com/csantanapr/mfp8-ionic-demo/blob/master/www/js/app.js
自定义 "MFP init" 触发后,您就可以使用上面的 WLAuthorizationManager
API.
如果失败,则说明您没有正确注册您的应用程序。
- 确保版本正确
- 确保包名称正确
请通读教程:https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/all-tutorials/
您还可以在此处找到带有 MFP 的 Ioic 应用示例:https://mobilefirstplatform.ibmcloud.com/labs/developers/8.0/intro/
我正在使用 ionic with mobilefirst 项目。当我首先尝试将 ionic App 与移动设备集成时,mobilefirst 服务器未与我的应用程序连接,在服务器控制台中我没有获得有关我的应用程序的任何信息。
配置:
- 移动优先:8.0.0
- 科尔多瓦:6.1.1
- android: 5.1.1
要让 MobileFirst Server 识别您的应用程序,第一步是注册应用程序。您可以通过两种方式执行此操作:
使用 MobileFirst CLI
- 确保安装了 CLI
- 导航到应用程序项目的根文件夹
- 运行 命令:
mfpdev app register
直接从 MobileFirst 控制台。 此步骤将要求您手动输入申请的详细信息
- 加载控制台,通常是 localhost:9080/mfpconsole(如果 运行 服务器在本地)
- 在边栏导航中的 "Applications" 旁边,点击 "New"
- 提供应用详情:
- 姓名
- 平台
- bundle ID 和版本(您可以在应用程序项目的 config.xml 文件中找到它们
下一步实际上是让应用程序向服务器发送请求以查看连接是否成功...
通过运行命令添加SDK:cordova plugin add cordova-plugin-mfp
打开应用程序的 index.js 文件并添加以下代码(仅作为示例):
function wlCommonInit() {
WLAuthorizationManager.obtainAccessToken().then(
function () {
alert ("successfully obtained a token from the server");
},
function(response) {
alert("Unable to obtain a token from the server: " + JSON.stringify(response));
}
);
}
看看这个 Ionic 示例:https://github.com/csantanapr/mfp8-ionic-demo/blob/master/www/js/app.js
自定义 "MFP init" 触发后,您就可以使用上面的 WLAuthorizationManager
API.
如果失败,则说明您没有正确注册您的应用程序。
- 确保版本正确
- 确保包名称正确
请通读教程:https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/all-tutorials/
您还可以在此处找到带有 MFP 的 Ioic 应用示例:https://mobilefirstplatform.ibmcloud.com/labs/developers/8.0/intro/