Back

Function not authenticate

  • 0
  • Web
  • Cloud
Haysquare
26 May, 2024, 04:56

Hello there, I was trying to access a funtion i create via appwrite cloud as a logged in user via sveltekit but on function it's seeing my request as guest while on app, it's showing as logged in

what am I doing wrong

TL;DR
Function created on Appwrite cloud not authenticating users properly in Sveltekit. Check the authentication handling in the function code. Be sure to verify the user's authentication status and permissions to access the function. Also, ensure that the user is properly logged in before calling the function.
Haysquare
26 May, 2024, 04:57

export const doFunction = (functionId, query) => { console.log('query: ', query); return functions.createExecution( FUNCTIONS[functionId], JSON.stringify(query) ).then(function (response) { console.log('A document', response); return { status: 200, // total: response.total, response: JSON.parse(response.responseBody) }; }).catch(function (error) { console.log(error); if (error.code == 401) { if (error.type == 'user_unauthorized') { alert(error.message) goto('/auth/login') } } return { status: error.code, errorType: error.type, error: error.messages }; }); };

This is how my request look like

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