Unauthoized error 401 failed http request

Frank E M Dannie 0 Reputation points
2023-02-15T06:35:08.6333333+00:00
I am trying to Create a Power Automate flow to register the device for push notifications using the Notification Hub. I got an error as Unauthorized with status 401.

I have created a HTTP action, with method POST and specified the URL for the Notification Hub registration API endpoint as "https://
Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
260 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 18,281 Reputation points
    2023-02-21T04:26:26.0166667+00:00

    Thanks for reaching here! If I have understood right you are using Azure notification hub and wants to register devices with notification hubs in order to receive push notifications.

    For details on Registration management refer to below detail link document:

    https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-registration-management

    To create a new registration, There is POST method which generates a registration ID, which you can subsequently use to retrieve, update, and delete this registration:

    https://learn.microsoft.com/en-us/rest/api/notificationhubs/create-registration

    If you are receiving response code 401 this means Authorization failure and the access key was incorrect or not present.

    From Azure Portal:

    2023-02-16 15_40_21-snagnotification (snagnt_snagnotification) - Microsoft Azure

    Further to elaborate to access these APIs the first thing is to generate the SAS Token, used as Authorization Header.

    The Authorization Header should consist of Token generated as specified in SAS Authentication and authorization with Microsoft Azure Active Directory Access Control.

    You may refer to this guide to generate SAS tokens using multiple programming languages for using Azure Service Bus REST APIs

    Further check these below articles for more details on How to use the Notification Hubs REST Interface.

    0 comments No comments