First login with Passwordless email fails

I set up Auth0 to gate access to a website using Cloudflare Workers by following this tutorial. (Finished example here.). I’m using Passwordless email auth. When the user enters her email and then pastes in her OTP code, signup succeeds, but she is redirected to a web page that simply says “Unauthorized”. Access to the site is only available if she logs in again after either:

  1. Deleting Auth0 cookies in the browser, or
  2. Using a private window or a different browser.

Logins also work OK if the email is added to Auth0 using the API before the user attempts to log in the first time.

Any clues on what might be causing this behavior?