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
- Function's Static IP
Is it possible to have static. IP Address instead of Dynamic IP for getting the IP Address whitelist
- How to use dart workspaces to deploy a f...
Hello, I'm developing a Flutter application and I would like to leverage dart pub workspaces to deploy a function with a dart runtime as advertised here : http...
- [SOLVED] Unable to push function from AP...
When trying to push functions from Gitlab CI (with an API KEY and using the CLI), i saw that i was unable to push functions. ``` $ appwrite client --endpoint $...