Search code examples
iosswiftazure-cognitive-servicesface-api

Microsoft Face API - Error 401, iOS


I have used the Subscription ID in my App and am getting following error at runtime.

Error Domain=POFaceServiceClient error - http response is not success : 
                {"error":{"code":"Unspecified","message":"Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."}}
                     Code=401 "(null)"

I taken the ID from the Keys after creating a new service. I even regenerated them. Every time I run the program, same error is thrown.

Hope you guys have a fix.

Cheers!


Solution

  • I could fix it finally. :)

    Over creating the API KEY, just make sure that you supply for westus server and the endpoint should be:

    https://westus.api.cognitive.microsoft.com/face/v1.0

    In my case, it works.