Programmatically get a test user's jwt for CI/CD backend tests

I use jest for my automated tests and currently have a nice test harness for sending post requests to my server. I hard code a string with the current test user’s jwt and all the tests work perfectly but if I wait 24 hours, the jwt expires and my end to end tests fail.

Is there a way my test environment can get a current jwt that matches what a test user would get from the website? I can get auth0 tokens but they don’t have the same ‘email’ ‘app_metadata’ and other things like that which I’d expect.

I know I could disable the authentication function for tests, but I’d really prefer not to. Is this possible without having to add selenium and a frontend?

1 Like

Hey there!

Sorry for such delay in response! We’re doing our best in providing the best developer support experience out there, but sometimes the number of incoming questions is just too big for our bandwidth. Sorry for such inconvenience!

Do you still require further assistance from us?

Solved here: Simply getting a JWT in exchange for a user/pass