You said GET request that in a cloud function. I’m trying to call it from the client. My master key doesn’t work on the client. Here’s more context
Client
const response = await axios.post(
`${API.baseURL}/profile/unsubscribe`,
{
address: profile.get("address"),
},
{
headers: {
"X-Parse-Master-Key": process.env.REACT_APP_MASTER_KEY,
"X-API-Key": process.env.REACT_APP_APPLICATION_ID,
},
},
);
Server/Routes
import {
unsubscribeFromAddress,
} from "../controllers/profilesController.js";
import { Router } from "express";
const router = Router();
router.post("/unsubscribe", unsubscribeFromAddress);
export default router;
Server/Controller
export const unsubscribeFromAddress = async (req, res) => {
try {
const { address } = req.body;
const results = await Moralis.Cloud.run(
"unwatchBscAddress",
{
address,
},
{
useMasterKey: true,
},
);
return res.send(results);
} catch (error) {
console.error(error);
}
};