NextJS - Persistent "Invalid authorization code" errors

Problem statement

We’ve started seeing “Invalid Authorization Code” errors on every login for production application.


  • All logins failing.
  • Using nextjs-auth0 v2.6.2
  • Made no changes to application or tenant configuration at time of failures.


We have found that we’ve had “a networking caching problem on the side of our Cloudflare Workers” that was responsible for making the duplicate request. It’s worth reviewing if app appears to have duplicate code exchange logs but not when running locally.