Auth0 Home Blog Docs

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

testing

#1

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?