Search code examples
c#push-notificationuwponesignalwns

Error on push notification for UWP App through WNS and OneSignal


I'm trying to use OneSignal for get push notification in my UWP App. I have already get App Secret and Package SID from Live Service (and registrered that on the OneSignal dashboard). By the documentation for [Windows UWP][1], I should register the device with the push token as identifier (and with device_type to 6).

I have got the channel uri with this code

PushNotificationChannel pushNotificationChannel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

and registrered the device on OneSignal without problem... but when I try to created a notification I get the following error (from OneSignal service):

{
"id": "",
"recipients": 0,
"errors": [
    "All included players are not subscribed"
],
"warnings": [
    "Windows Platform Errors: (Invalid Windows credentials) Windows rejected the request for an authentication token due to invalid credentials. Please check that your credentials are correct."
]

}

I have tryed to register the device with the identifier assigned to ONLY the token extracted from the channel uri, and also with the entire channel uri. But I always get the same error.

Somebody have experience on WNS and OneSignal?

Here the JSON of the device from OneSignal:

{
        "id": "cce63....",
        "identifier": "https://db5p.notify.windows.com/?token=AwYAAAB0h....",
        "session_count": 1,
        "language": "it",
        "timezone": null,
        "game_version": null,
        "device_os": null,
        "device_type": 6,
        "device_model": null,
        "ad_id": null,
        "tags": {},
        "last_active": 1540676034,
        "playtime": 0,
        "amount_spent": 0,
        "created_at": 1540676034,
        "invalid_identifier": false,
        "badge_count": 0,
        "sdk": null,
        "test_type": null,
        "ip": null
    }

Thank you,

Regards


Solution

  • Speaking with my colleague that he has configured OneSignal, I found that the App Secret were been typed wrong in the OneSignal configuration... After the correction of the App Secret, obviously, it works fine.