Back

Get response from Appwrite Function with Users only execute access permission

  • 0
  • Functions
James
20 Feb, 2025, 23:15

So let's say I have an endpoint (https://RANDOM_APPWRITE_ENDPOINT.appwrite.global/) and it has a basic function like this:

TypeScript
export default async ({ req, res, log, error }) => {

return res.json({ status: true }, 200, {
          'Access-Control-Allow-Origin': 'ENTER_MY_ENDPOINT_HERE',
        }); 
}```


I can call this function using axios and get the response "status: true" when my execute access is set to ANY

try { const response = await axios.get('https://RANDOM_APPWRITE_ENDPOINT.appwrite.global/'); console.log(response.data); } catch (error) { console.log(error); }```

How can I get the response "status: true" if my execute access is set to USERS only? I am logged in using createEmailPasswordSession

TL;DR
The developer wants to get the response "status: true" from an Appwrite Function with execute access set to USERS only. The solution involves passing the user's session details when making the axios call to authenticate the request properly.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more