Comment on page


Learn how to use the testing features for your authorizer
Test your function using a valid and invalid legacy token in the “Test” tab of the code editor. Running a test will simulate a request to an authenticated endpoint in order to test if the authorizer code is properly authorizing users.
Test results and logs will be displayed in the bottom portion of the code editor. You may add your own logs for debugging using the context.log(msg: string) function that is available in all authorizers. If the test is successful, the code editor will show return a test user.
Example of unsuccessful test (invalid token) that will deny access
Example of successful test that grants access to a test user
Log statements will also be shown during test runs
To run a test, you should provide a valid session token from your application. In a test environment, the context.getOrCreateUser() function will not actually create a user, so the test user will always be returned.