Hi
I am trying to call a function from my mobile app, but I am receiving "Invalid token expired."
My code looks more or less like this
// from my app
functions.createExecution(
"import-function",
JSON.stringify(data),
true,
"/",
ExecutionMethod.POST);
// my function
import { Client, Databases, ID } from "node-appwrite";
export default async ({ req, res, log, error }) => {
const client = new Client().setProject(process.env.APPWRITE_PROJECT_ID);
if (req.headers["x-appwrite-user-jwt"]) {
client.setJWT(req.headers["x-appwrite-user-jwt"]);
} else {
return res.json(
{
error:
"Access denied: This function requires authentication. Please sign in to continue.",
},
401,
);
}
// rest
}
Here more details about my code: https://jumpshare.com/s/60JUJtYCBY0F2TNsuwhH
I don't even receive 401, but I receive a 500 status code.
So, my question is: Do I send/implement something else from my app/function ?
Thanks
Recommended threads
- Immediate function execution seems to be...
Whenever I try to execute a function manually I get an error that the schedule is a required field (even though Now is selected). Not a huge deal, I can obvious...
- Verification failed
I am unable to connect custom domain. it keeps on verifying and when i refresh it says verification failed. I bought my domain from hostinger. my instance is r...
- Creating Function to Submit Email Form f...
I'm trying to create function for Email Form Submit, I fill parameters correctly using my Resend provider, I connect it to my repository, but when I click on De...