I have written some cloud functions and deployed them. Initially, I was using a single function onUpdate, and it's working fine. Today I've created a simple onCall function that I'm willing to call from iOS Firebase SDK. this is the test function that I'm assuming to work but it is giving me Unauthenticated error in the response.
exports.test = functions.https.onCall((data, context) => {
console.log('test call info', data, context);
return 'hello, world!';
});
When I check the logs on firebase, it is showing me the below logs -
Can anybody help me in resolving this issue? Few key points -
Here is the iOS app code where I'm calling the cloud function -
let functions = Functions.functions()
functions.httpsCallable("test").call() { res, error in
if let error = error {
debugPrint(error)
} else {
debugPrint(res?.data)
}
}
Thanks
Regarding the docs about Protocol specification for https.onCall, I suggest taking a look to the paragraph Response format: status codes.
The issue seems to point to “If the auth token supplied in the request is invalid, the request is rejected with 401 Unauthorized, with an error code of UNAUTHENTICATED.”
You may find this question interesting too.