1

我正在开发使用IBM MobileFirst平台8.0具有推送通知功能的iOS应用获取机密客户令牌IBM MobileFirst平台 - 从适配器

我有管理通过邮递员发送通知,这个过程是

  1. 从移动第一平台服务器
  2. 获得令牌通过REST API发送到通知随着令牌

教程链接我必须遵循的是,

服务器端 - https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/sending-notifications/

客户端 - https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/handling-push-notifications/cordova/

获得令牌 - https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/authentication-and-security/confidential-clients/#obtaining-an-access-token

现在,我试图发送一个推当应用程序触发适配器调用时发出通知

我目前被困在获取托克使用WL.Server.invokeHttp型氮部分,下面是更适配器代码和连接设置

function getToken() { 
    var input = { 
     method : 'post', 
     returnedContentType : 'application/json',  
     path : '/mfp/api/az/v1/token',  
     headers : { 
      Authorization:"Basic UHVzaE5asdasdas4444rrraWNhdGlvbjpQdXNoasdasd0aW9u", 
      contentType:'application/x-www-form-urlencoded' 
     }, 
     body:{ 
      grant_type : "client_credentials", 
      scope : "push.application.my.app messages.write", 

     } 

    }; 

    var results = MFP.Server.invokeHttp(input); 
    return results; 
} 

<connectivity> 
     <connectionPolicy xsi:type="http:HTTPConnectionPolicyType"> 
      <protocol>http</protocol> 
      <domain>127.0.0.1</domain> 
      <port>9080</port> 
      <connectionTimeoutInMilliseconds>60000</connectionTimeoutInMilliseconds> 
      <socketTimeoutInMilliseconds>60000</socketTimeoutInMilliseconds> 
      <maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode> 
     </connectionPolicy> 
    </connectivity> 

真的希望的意见,在此先感谢。

回答

0

我管理这些代码

var requestStructure = { 
     method : 'post', 
     returnedContentType : 'json', 
     path : '/mfp/api/az/v1/token',  
     headers: { 
      "Content-Type" : "application/x-www-form-urlencoded", 
      "Authorization" : "Basic UHVzaE5asdasdas4444rrraWNhdGlvbjpQdXNoasdasd0aW9u" 
     }, 
     parameters:{ 
      "grant_type" : "client_credentials", 
      "scope" : "push.application.my.app messages.write" 
     } 
    }; 

    var results = MFP.Server.invokeHttp(requestStructure); 
    return results; 
解决呢
相关问题