Verification of publisher domain failed. The server returned an unexpected content type header value

Viewed 375

I'm using MERN STACK. I've been stuck on this forever now, I've been trying to verify my publisher domain on Azure portal but it keeps telling me that it has invalid header content type, I just downloaded the JSON file they provided and pasted it into the public/.well-known folder in my react app, deployed it to server and then opened it in the browser, it's opening but it's showing an html file to me instead of JSON. I'm new to this and have no idea what to do, I didn't find anything close to a solution on the web.

JSON FILE

{
  "associatedApplications": [
    {
      "applicationId": "my application id"
    }
  ]
}

BROWSER RESULT

Now, it's showing me an html file instead of a JSON object

EXACT RESPONSE FROM AZURE

Verification of publisher domain failed. Error getting JSON file from https://example.com/.well-known/microsoft-identity-association. The server returned an unexpected content type header value

1 Answers

As the guide mentions

The expected 'Content-Type' header that should be returned is application/json. You may get an error as mentioned below if you use anything else...

I am not sure what web server you are deploying your React app to. But depending on that configure your .well-known/microsoft-identity-association file path to be served with 'Content-Type' header as application/json. Or, since you are into MERN stack, you can also consider to create an Express route with same and control the header in response.

Related