Strapi authentication through my Next.js application return "Please provide your username or your e-mail."

I’m currently working through Brad Traversy’s Next.js Dev to Deployment | Udemy course, and we’re building a Next.js front end and a strapi backend. Everything is working except whenever I login through my application, regardless of the strapi user or the credentials, my Next.js app receives “Please provide your username or your e-mail.” from strapi. I can log in ok using Postman but has anyone else seen this type of behavior? I’ve set up numerous strapi accounts with varying access levels for debugging and that doesn’t seem to matter, and the only error message being thrown is getting caught in my if/else code (400 Bad Request). I can post any code as requested.

Any help is very appreciated.

Hi Rich, I used this and it worked. Could it be that you didn’t declare the Content-Type?

const res = await fetch(`${API_URL}/auth/local`, {

    method: "POST",

    headers: {

      "Content-Type": "application/json",


    body: JSON.stringify(loginDetails),