Communication Service: Denied by the resource provider.

Letian Xu 31 Reputation points
2023-04-14T01:00:37.57+00:00

Hi, I need some help on sending email through Communication Services by an Http post request, using Postman. I am following this article (expect I am using email not sms): https://learn.microsoft.com/en-us/azure/communication-services/tutorials/postman-tutorial However, all I get is a 401 Unauthorized error: "Denied by the resource provider" I have tried sample code provided in GitHub and I can confirm my communication services is working ok with js library "@azure/communcation-email". Can any one provide any suggestion on this? Thanks heaps.

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
1,242 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Grmacjon-MSFT 19,301 Reputation points Moderator
    2023-04-18T19:29:24.6466667+00:00

    Hi @Letian Xu ],

    thanks for bringing this to our attention. this sounds like an authentication/ authorization issue based on the error message you shared. to troubleshoot this issue you can:

    1. Make sure that you have correctly configured your Communication Services resource and obtained the required credentials, such as the Azure Communication Services connection string or access token. Make sure you are using the correct credentials in your Postman request.https://learn.microsoft.com/en-us/azure/communication-services/concepts/authentication
    2. Double-check that you are using the correct endpoint and request URL in your Postman request. The endpoint should be in the format https://<your-resource-name>.communication.azure.com/, and the request URL should be in the format /<api-version>/communications/send.
    3. Ensure that your Postman request includes the correct headers, including the Authorization header with your access token, the Content-Type header set to application/json, and the x-ms-content-type header set to multipart/mixed.

    Hope that helps.

    Best, Grace


  2. Letian Xu 31 Reputation points
    2023-05-05T01:00:49.0466667+00:00

    Hi @Grmacjon-MSFT ,

    Sorry for the late reply.

    My issue was resolved but according to the information you provided.

    The problem is in the tutorial:

    https://learn.microsoft.com/en-us/azure/communication-services/tutorials/postman-tutorial

    Host is added as part of HMAC-SHA256 signed header but signature doesn't include the encrypted host.

    By adding encrypted host into signature fixed my issue.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.