【问题标题】:IBM MobileFirst Platform - Get Confidential Client Token from AdapterIBM MobileFirst Platform - 从适配器获取机密客户端令牌
【发布时间】:2017-03-28 08:09:22
【问题描述】:

我正在使用具有推送通知功能的 IBM MobileFirst Platform 8.0 开发 iOS 应用程序

我已经设法通过邮递员发送通知,过程是

  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>

希望得到建议,在此先感谢。

【问题讨论】:

    标签: ios push-notification ibm-mobilefirst mobilefirst-adapters


    【解决方案1】:

    我设法用这些代码解决了它

    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;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      • 2020-04-08
      • 2018-04-25
      相关资源
      最近更新 更多