推送吐司通知无法在azure中工作

时间:2013-10-21 12:18:03

标签: azure windows-8

通过azure中的调度程序运行时,我的Toast通知的推送通知代码未运行。我的代码是

     function EWSReminder() {    
          push.wns.sendToastText01("https://sin.notify.windows.com/?          token=Ysdfdhjkdjksj%2fAScjFHiwrUbS6y%2bvumj9sKUqhklsdfjgfdslcvl;dklslkskdlsdl;9XD58CMJebd04EknQY0Hgaxed6%uirutiuritubW%2fRcpdvapAYlMcnWLE360%3d", {
               text1: "Sample toast from sample insert"
            }, {
            success: function(pushResponse) {
                console.log("Sent push:", pushResponse);
            }
            );
}

我收到此错误

Error in script '/scheduler/EWSReminder.js'. Error: The options.client_id and options.client_secret must be specified as strings or the WNS_CLIENT_ID and WNS_CLIENT_ID environment variables must be set.
[external code]
at EWSReminder (</scheduler/EWSReminder.js>:2:16)
at </scheduler/EWSReminder.js>:1:13
[external code]

我无法弄清楚问题是什么帮助。我已经应用了所有可用的微软样本代码都具有相同的代码,但没有一个对我有用。

2 个答案:

答案 0 :(得分:0)

您需要在Azure门户中设置客户端密钥和包SID(移动服务中的“推送”选项卡)。可以通过Windows Store Developer Portal获取这些凭据。

答案 1 :(得分:0)

即使我也有同样的问题,我已将这些值放在我从Windows应用商店门户网站获取的门户中。

以下代码适用于我,但上述代码并非如Yesh所示。

var pushWNS = require('wns');
pushWNS.sendToastText01(uri, { text1: Name }, { client_id: 'xxx', client_secret: 'xxx' },
    function (error, response)
    {
        if (!error)
        {
            // success code            
        }
        else
        {
            // error handling
        }
    });

我也想知道我和Yesh

提到的两个代码之间的区别