I recently created a cloud function that involves linking with Plaid. I'm currently working on calling this function using AngularJS's $http method. While the cloud function code is being executed, I encountered an error in my console instead of the expected success response.
This is how my AngularJS $http call looks like:
var token = 'randomGeneratedCode';
$http({
method: 'GET',
headers: {
'Content-Type' : 'application/json'
},
url: '<hidden-url>?token='+token
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log(response);
});
The error message that pops up is:
XMLHttpRequest cannot load <hidden-url>?token=randomGeneratedCode. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:5000' is therefore not allowed access.
In case it helps, here is the content of my index.js file for firebase cloud functions:
https://jsfiddle.net/hho25045/