NotificationHubUnauthorizedException: Unauthorized on Azure Notification Hub registration

后端 未结 3 2020
小蘑菇
小蘑菇 2021-01-20 13:52

So I\'m trying the Notification Hubs on Azure.

I have set things up according to this blog post. I have done the GCM setup in my Android code so I have a valid regId

3条回答
  •  独厮守ぢ
    2021-01-20 14:19

    Unfortunately there is a bug in the management portal that corrupts a NH authorization rules. It will be solved very soon. In the meantime, you can create a new NH from a Console App and Service Bus preview dll with the following code:

    NamespaceManager mgr = NamespaceManager.CreateFromConnectionString("");
    var hub = new NotificationHubDescription("myhub");
    hub.GcmCredential = new GcmCredential("");
    mgr.CreateNotificationHub(hub);
    

    Make sure to use the connection string retrieved from the portal in the following way: 1) Click Service Bus on the left pane 2) On the right-pane, select your namespace, then click Connection Information 3) Copy the Connection String for RootAccess, as shown below:

    enter image description here

    Sorry for the inconvenience.

提交回复
热议问题