【问题标题】:How to identify user in safari web push notification如何在 Safari 网络推送通知中识别用户
【发布时间】:2018-09-09 17:21:32
【问题描述】:

我正在使用 APNS 向 safari 发送网络推送通知。在网络上:

window.safari.pushNotification.requestPermission(
        'https://domain.example.com', // The web service URL.
        'web.com.example.domain',     // The Website Push ID.
        {userId: '111111'}, // Data that you choose to send to your server to help you identify the user.
        checkRemotePermission         // The callback function.
    );

在后端,我添加了端点:

发布:

webServiceURL/version/devices/deviceToken/registrations/websitePushID

删除:

webServiceURL/version/devices/deviceToken/registrations/websitePushID

发布:

webServiceURL/version/log

但是这些 API 是在没有任何 cookie 的情况下调用的,BE 只是接收到设备令牌,而没有任何关于哪个用户正在登录的信息。

我尝试将 {userId: '111111'} 添加到 FE 中的数据以希望将其发送到 BE,但我在 BE 中没有收到任何信息。

有人有解决办法吗?

【问题讨论】:

    标签: safari apple-push-notifications


    【解决方案1】:

    应该有另一个端点用于下载推送包。

    发布

    webServiceURL/version/pushPackages/websitePushID
    

    在上述端点调用的方法中,应该可以得到请求体中的{"userId": "111111"}。

    还可以尝试将 {userId: '111111'} 更改为 {"userId": "111111"}

    【讨论】:

      猜你喜欢
      • 2017-03-23
      • 2018-11-24
      • 1970-01-01
      • 2019-05-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多