Hi there, I have a function which should act like a user in most ways and therefore init the client with a JWT token. Now I want to test the method, but I cannot find any way to generate a jwt token for a test user I created. Is there a way to do this? Cheers! <:appwriteheart2:1073243188954935387>
account.createJWT() i think
for example you can then send this jwt in headers
Yes, but I am not testing the function from client side. So there is no option to create a JWT Token there
There is none
You'll need to use the createJWT to generate the JWT, then use it in the test.
You can use Postman for generating the JWT after log in the user.
Mhh this does not seem like an optimal solution, but I'll take it
If you need it for more then tests
There is another approach
when an end user executes a function, the function automatically has a JWT token set that can be used to make requests on behalf of the user...why not use that?
Theoretically yes, therefore I would have to use the client to test the function correct? Because I wanted to do it locally and therefore would have to go the way @Binyamin mentioned and generate a jwt token manually.
you can just create a session and then execute the function. i don't think you need the extra step of creating a jwt token. maybe you can use this tool: https://github.com/stnguyen90/appwrite-explorer
Alright I'll try that, thanks @Steven & @Binyamin :appwriteheart2:
Recommended threads
- Error trying to deploy functions from CL...
✗ Error • on-auth-create (6a00b2ab000c9ce2949b) • Server Error ✗ Error: No functions were pushed. Prject ID: 69ffe0270033a4ac420a
- Intermittent Deploy and Execution Errors...
Project: project-fra-658e2f5f4ba30df91177 Function ID: 69bde006001c56757f49 **Several execution errors with:** Timed out waiting for runtime.\nError Code: 400...
- ~20 function variables disappeared
Hi, In one of my functions about 20 variables just disappeared. The "Next" button also seems to be bugged. The "total variables" text still says the correct amo...