RonnyCSHARP
RonnyCSHARP

Reputation: 93

send push notification with Azure Notification Hub (Unauthorized 401)

I want to send push notifications to a iphone. It works fine if I send a message from the Azure Notification Hub - Website, but I can't send a notification from my c# console application.

I have added the Microsoft.Azure.NotificationHubs - Nuget Package,

        var client = NotificationHubClient.CreateClientFromConnectionString ( HUBLISTENACCESS, HUBNAME );

        client.SendAppleNativeNotificationAsync ( json ).ContinueWith (
            t => {
                Console.WriteLine (t.Result );
            } );

        Console.ReadLine();

but it raises an exception "not authorized 401".

I hope anyone could help. Regards Ronny

Upvotes: 1

Views: 1065

Answers (1)

ankur
ankur

Reputation: 96

var client = NotificationHubClient.CreateClientFromConnectionString ( HUBLISTENACCESS,

The problem is that LISTENACCESS key doesn't have permissions for SendOperations. Can you try with FULLACCESS keys?

Upvotes: 7

Related Questions