如何在Safari网页推送通知中识别用户

问题描述 投票:0回答:1

我正在使用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.
    );

在后端,我添加端点:

POST:

webServiceURL/version/devices/deviceToken/registrations/websitePushID

删除:

webServiceURL/version/devices/deviceToken/registrations/websitePushID

POST:

webServiceURL/version/log

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

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

有人有解决方案吗?

safari apple-push-notifications
1个回答
0
投票

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

POST

webServiceURL/version/pushPackages/websitePushID

在上述端点调用的方法中,您应该能够在请求正文中获得{“userId”:“111111”}。

同时尝试将{userId:'111111'}更改为{“userId”:“111111”}

© www.soinside.com 2019 - 2024. All rights reserved.