在 IBM bluemix 云上找不到推送通知服务的 appSecret
Could not find appSecret for push notification services on IBM bluemix cloud
我想通过 Java 应用程序使用 PushNotinfication 服务,因此我需要该服务的 appGuid 和 appSecret。 (此消息所附的图显示了 window appSecret 应该显示但它没有。) enter image description here一些文档说当应用程序绑定到服务时会自动生成 appSecret 但是我无法理解绑定过程。
所以我想尽可能详细地了解发布PushNotification Service的appSecret的过程。如果有人能用每个过程的 window 的屏幕截图进行解释,我将不胜感激。
@ken 我们在 swagger(http://imfpush.ng.bluemix.net/imfpush/) 中同时支持 AppSecret 和 Tokens。对于创建的新实例,不会有任何 AppSecret,因为它们是基于 IAM 的实例。而且除了Token认证方式外别无他法。
那些在 2018 年 6 月之前创建的实例将使用 Appsecret。但新实例将仅适用于 IAM 令牌。这是为了更好的安全性而引入的。请参阅我们的发行说明以了解相同的 https://console.bluemix.net/docs/services/mobilepush/release-notes.html#release-notes。
要了解有关推送通知服务上 IAM 实施的更多信息,请参阅 https://console.bluemix.net/docs/services/mobilepush/push_iam.html#service-access-management
请参阅我们的常见问题解答部分中的问题 21 https://console.bluemix.net/docs/services/mobilepush/push_faq.html#faq 以了解如何检索令牌和使用。
关于 Swagger,引入了一个新的授权字段来提交 IAM 令牌。 Authorization 字段或 appSecret 是必需的。
请参阅服务器 sdk (https://github.com/ibm-bluemix-mobile-services/bms-pushnotifications-serversdk-java) 自述文件,其中客户必须使用 ApiKey 为新的推送实例初始化推送,IAM 令牌是通过初始化方法自动生成的..
PushNotifications.initWithApiKey("YOUR_APPLICATION_ID", "YOUR-BLUEMIX-PUSH-APIKEY", PushNotifications.US_SOUTH_REGION);
样本
public static void main(String[] args) {
PushNotifications.initWithApiKey("appId", "APIKey", PushNotifications.US_SOUTH_REGION);
Message message = new Message.Builder().alert("20% Off Offer for you").url("www.ibm.com").build();
String [] deviceIds = {"deviceIds"};
Target target = new Target.Builder().deviceIds(deviceIds).build();
Notification notification = new Notification.Builder().message(message).target(target).build();
PushNotifications.send(notification, new PushNotificationsResponseListener(){
public void onSuccess(int statusCode, String responseBody) {
System.out.println(responseBody);
System.out.println("Successfully sent push notification! Status code: " + statusCode + " Response body: " + responseBody);
}
public void onFailure(Integer statusCode, String responseBody, Throwable t) {
System.out.println("Failed sent push notification. Status code: " + statusCode + " Response body: " + responseBody);
if(t != null){
t.printStackTrace();
}
}
});
}
希望对您有所帮助。
我想通过 Java 应用程序使用 PushNotinfication 服务,因此我需要该服务的 appGuid 和 appSecret。 (此消息所附的图显示了 window appSecret 应该显示但它没有。) enter image description here一些文档说当应用程序绑定到服务时会自动生成 appSecret 但是我无法理解绑定过程。 所以我想尽可能详细地了解发布PushNotification Service的appSecret的过程。如果有人能用每个过程的 window 的屏幕截图进行解释,我将不胜感激。
@ken 我们在 swagger(http://imfpush.ng.bluemix.net/imfpush/) 中同时支持 AppSecret 和 Tokens。对于创建的新实例,不会有任何 AppSecret,因为它们是基于 IAM 的实例。而且除了Token认证方式外别无他法。 那些在 2018 年 6 月之前创建的实例将使用 Appsecret。但新实例将仅适用于 IAM 令牌。这是为了更好的安全性而引入的。请参阅我们的发行说明以了解相同的 https://console.bluemix.net/docs/services/mobilepush/release-notes.html#release-notes。 要了解有关推送通知服务上 IAM 实施的更多信息,请参阅 https://console.bluemix.net/docs/services/mobilepush/push_iam.html#service-access-management 请参阅我们的常见问题解答部分中的问题 21 https://console.bluemix.net/docs/services/mobilepush/push_faq.html#faq 以了解如何检索令牌和使用。
关于 Swagger,引入了一个新的授权字段来提交 IAM 令牌。 Authorization 字段或 appSecret 是必需的。
请参阅服务器 sdk (https://github.com/ibm-bluemix-mobile-services/bms-pushnotifications-serversdk-java) 自述文件,其中客户必须使用 ApiKey 为新的推送实例初始化推送,IAM 令牌是通过初始化方法自动生成的..
PushNotifications.initWithApiKey("YOUR_APPLICATION_ID", "YOUR-BLUEMIX-PUSH-APIKEY", PushNotifications.US_SOUTH_REGION);
样本
public static void main(String[] args) {
PushNotifications.initWithApiKey("appId", "APIKey", PushNotifications.US_SOUTH_REGION);
Message message = new Message.Builder().alert("20% Off Offer for you").url("www.ibm.com").build();
String [] deviceIds = {"deviceIds"};
Target target = new Target.Builder().deviceIds(deviceIds).build();
Notification notification = new Notification.Builder().message(message).target(target).build();
PushNotifications.send(notification, new PushNotificationsResponseListener(){
public void onSuccess(int statusCode, String responseBody) {
System.out.println(responseBody);
System.out.println("Successfully sent push notification! Status code: " + statusCode + " Response body: " + responseBody);
}
public void onFailure(Integer statusCode, String responseBody, Throwable t) {
System.out.println("Failed sent push notification. Status code: " + statusCode + " Response body: " + responseBody);
if(t != null){
t.printStackTrace();
}
}
});
}
希望对您有所帮助。