I was facing same issue but finally make it work. i'm using Maui App but test it on Universal Windows App and it worked too.
follow these steps, if your setup of the notification hub is successful, it may help:
1- In the OnLaunched() add these lines:
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
channel.PushNotificationReceived += Channel_PushNotificationReceived;
NotificationHubClient hub = new NotificationHubClient("Endpoint=sb://DefaultListenSharedAccessSignature connection string", "YOURHUBNAME");
var reg = await hub.CreateWindowsNativeRegistrationAsync(channel.Uri);
make sure that the connection string is the listener connection string not the full access CS.
optionally you can add tags to send to while registering the channel uri with CreateWindowsNativeRegistrationAsync(channelUri, new { array of tags })
2- Add the Notification received handler:
private void Channel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs args)
{
//handle notification received here
{
var data = args.ToastNotification.Data;
//data.Values;
}
}
3- Run the app, and test to send notification, without tags or to tags you already register them.
for this to work you need to correctly sign your application by right click the project and "Publish...".
The 403 code is caused by incorrect signature of your app or from invalid access token that you have to request to send push to a specific channel or tag. by using your Client Security Key (O~....) and the Package SID (ms-app://S-....)
hope this help