小编Gio*_*aki的帖子

将身份验证添加到静态Azure网站

我们有一个Azure网站托管静态网站(只是一些HTML,CSS,Javascript),然后通过AJAX调用与我们的Azure移动服务进行通信.

我们想为这个站点添加一些非常简单的身份验证(只需一个静态用户名/密码就足够了).

请推荐最简单的方法.

或者可能有更好的选择来提供静态内容,而不是Azure网站?

authentication azure azure-web-sites

8
推荐指数
1
解决办法
1万
查看次数

如何在azure移动服务(服务器脚本)中查询行"where IN [some-array-of-numbers]"

我的任务是通过给定的ID列表deviceTokens从我的clientDevices表中查询.然后向该客户端发送推送通知.

我通过将以下数据插入pushRequests表来获取ID 列表:

{
  "alert": "Hello customer!",
  "badge": 1,
  "recipients": [2, 4, 5]
}
Run Code Online (Sandbox Code Playgroud)

我写了这个服务器端插入功能:

function insert(item, user, request) {
  if (item.recipients) {
    tables.getTable('clientDevices').where(function(ids) {
      return (ids.indexOf(this.id) > -1)
    }, item.recipients).read({
      success: function(results) {
        // . . .
        // Send push notifications to this guys
        // . . .
      }
    })
    item.recipients = JSON.stringify(item.recipients)
  }
  request.execute()
}
Run Code Online (Sandbox Code Playgroud)

但我得到一个奇怪的错误:

Error in script '/table/pushRequests.insert.js'. Error: The expression 'ids.indexOf(this.id)'' is not supported.
Run Code Online (Sandbox Code Playgroud)

如果indexOf不支持函数,那么如何制作"field IN array"样式过滤器?我可以将数组 …

javascript azure azure-mobile-services

2
推荐指数
1
解决办法
1078
查看次数

Azure移动服务"push.apns.send"的成功回调

push.apns.send方法不会调用success回调.因此,如果成功执行,我们无法确定此操作何时完成.

这是我的代码(它是服务器端脚本的一部分,它在其中一个数据表的insert事件上运行):

  push.apns.send(message.deviceToken, {
    alert: message.alert,
    badge: message.badge,
    sound: message.sound,
    payload: {
      message: message.alert,
      appID: message.appID
    }
  }, {
    success: function(resp) {
      console.log(resp)
    },
    error: function(err) {
      console.error(err)
    }
  })
Run Code Online (Sandbox Code Playgroud)

error回调有效.例如,当我传递无效时deviceToken,我可以在日志中看到错误消息.但是在成功执行的情况下,日志中没有任何内容.它似乎根本没有调用success回调.

它没有在这个例子中显示,但在我的情况下,我需要success回调来改变记录的状态并保存它.

javascript azure push-notification apple-push-notifications azure-mobile-services

2
推荐指数
1
解决办法
926
查看次数