I dont understand why this behavior when i change ports, i had been using 3000 to serve my site separately then switched to within public in strapi and now auth/local wont work unless i serve strapi on 3000

here are the logs
SEE THE 400 THEN 200 STATUS ON AUTH/LOGIN ENDOINTS

[2021-05-09T14:37:04.430Z] info File changed:     D:\PROJECTS\smallprojs\flowtowStrapi\api\flowtow\config\server.js
[2021-05-09T14:37:04.441Z] info The server is restarting


 Project information

┌────────────────────┬──────────────────────────────────────────────────┐
│ Time               │ Sun May 09 2021 17:37:21 GMT+0300 (East Africa … │
│ Launched in        │ 13631 ms                                         │
│ Environment        │ development                                      │
│ Process PID        │ 15948                                            │
│ Version            │ 3.6.1 (node v15.8.0)                             │
│ Edition            │ Community                                        │
└────────────────────┴──────────────────────────────────────────────────┘

 Actions available

Welcome back!
To manage your project 🚀, go to the administration panel at:
http://localhost:3000/admin

To access the server ⚡️, go to:
http://localhost:3000

[2021-05-09T14:37:33.158Z] debug GET / (26 ms) 200
[2021-05-09T14:37:33.296Z] debug GET /css/style.css (23 ms) 200
[2021-05-09T14:37:33.319Z] debug GET /news-newspaper1-512.webp (4 ms) 200
[2021-05-09T14:37:33.543Z] debug GET /49895.png (11 ms) 200
[2021-05-09T14:37:33.548Z] debug GET /loudpost.png (9 ms) 200
[2021-05-09T14:37:33.551Z] debug GET /camposts.png (16 ms) 200
[2021-05-09T14:37:34.673Z] debug GET /posts?_limit=3&_sort=likes:desc (137 ms) 200
[2021-05-09T14:37:34.764Z] debug GET /posts?_limit=10&_sort=published_at:desc (187 ms) 200
[2021-05-09T14:37:34.809Z] debug GET /uploads/small_sydney_cc8d761bff.jpg (7 ms) 200
[2021-05-09T14:37:34.857Z] debug GET /uploads/small_food_3e78572fe5.jpg (15 ms) 200
[2021-05-09T14:37:34.925Z] debug GET /posts?_limit=10&_sort=likes:desc (344 ms) 200
[2021-05-09T14:37:34.987Z] debug GET /uploads/small_opera_house_6410152abb.jpg (55 ms) 200
[2021-05-09T14:37:34.999Z] debug GET /uploads/small_screencapture_ilearn_mq_edu_au_login_index_php_2021_05_06_17_59_41_4c068c42bb.png (14 ms) 200
[2021-05-09T14:37:35.125Z] debug GET /posts?_sort=published_at:desc (417 ms) 200
[2021-05-09T14:37:43.330Z] debug POST /auth/local (1274 ms) 200
[2021-05-09T14:37:43.662Z] debug GET /posts?user=3&_sort=published_at:desc (255 ms) 200
[2021-05-09T14:38:06.808Z] info File changed: D:\PROJECTS\smallprojs\flowtowStrapi\api\flowtow\config\server.js
[2021-05-09T14:38:06.810Z] info The server is restarting


 Project information

┌────────────────────┬──────────────────────────────────────────────────┐
│ Time               │ Sun May 09 2021 17:38:18 GMT+0300 (East Africa … │
│ Launched in        │ 8630 ms                                          │
│ Environment        │ development                                      │
│ Process PID        │ 6292                                             │
│ Version            │ 3.6.1 (node v15.8.0)                             │
│ Edition            │ Community                                        │
└────────────────────┴──────────────────────────────────────────────────┘

 Actions available

Welcome back!
To manage your project 🚀, go to the administration panel at:
http://localhost:1337/admin

To access the server ⚡️, go to:
http://localhost:1337

[2021-05-09T14:38:27.133Z] debug GET / (35 ms) 200
[2021-05-09T14:38:27.282Z] debug GET /css/style.css (22 ms) 200
[2021-05-09T14:38:27.289Z] debug GET /news-newspaper1-512.webp (10 ms) 200
[2021-05-09T14:38:27.525Z] debug GET /49895.png (10 ms) 200
[2021-05-09T14:38:27.527Z] debug GET /camposts.png (8 ms) 200
[2021-05-09T14:38:27.528Z] debug GET /loudpost.png (8 ms) 200
[2021-05-09T14:38:28.696Z] debug GET /posts?_limit=3&_sort=likes:desc (161 ms) 200
[2021-05-09T14:38:28.737Z] debug GET /posts?_limit=10&_sort=published_at:desc (184 ms) 200
[2021-05-09T14:38:28.845Z] debug GET /uploads/small_sydney_cc8d761bff.jpg (25 ms) 200
[2021-05-09T14:38:28.894Z] debug GET /uploads/small_food_3e78572fe5.jpg (16 ms) 200
[2021-05-09T14:38:28.897Z] debug GET /uploads/small_opera_house_6410152abb.jpg (17 ms) 200
[2021-05-09T14:38:29.009Z] debug GET /posts?_limit=10&_sort=likes:desc (446 ms) 200
[2021-05-09T14:38:29.083Z] debug GET /uploads/small_screencapture_ilearn_mq_edu_au_login_index_php_2021_05_06_17_59_41_4c068c42bb.png (25 ms) 200
[2021-05-09T14:38:29.182Z] debug GET /posts?_sort=published_at:desc (420 ms) 200
[2021-05-09T14:38:44.505Z] debug POST /auth/local (1027 ms) 400

A 400 error code implies that there’s an issue with the client-side request:

Are you certain that the problem is with Strapi?

ok then what is the solution, look i have just changed the port on strapi, absolutely nothing else on the client code has been adjusted. here is the code requesting login:

console.log(target);

                                  console.log(" with details ")

                                  console.log(target.querySelector("#email").value)

                                  console.log(target.querySelector("#password").value)

                                  fetch(

                                      '/auth/local', {

                                      method: 'post',

                                      headers: {

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

                                      },

                                      body: JSON.stringify(

                                          {

                                              identifier: target.querySelector("#email").value,//"stud@university.com",

                                              password: target.querySelector("#password").value//"LtZm@7FEeQs9HjD"

                                          }

                                      )

                                  },

                                  )

                                      .then(response => response.json())

                                      .then(function (data) {

                                          console.log(data)

                                          console.log("login successful ");

hey also dont forget when replying that strapi returns 400 even on bad email or password, however here th code is sending the very exact data on the two instances, so i dont know what is happening here

Tbh, I’m still feeling my way around Strapi and being able to serve the front-end separately from the backend. Generally, I have been changing the ports in app/config/server.js per the documentation whereas I notice it looks like you’ve changed the server.js file in the API itself. I’m not familiar with this, could you point me to the documentation that you used?

it is just changing this port in config/server.js

module.exports = ({ env }) => ({

  host: env('HOST', '0.0.0.0'),

  port: env.int('PORT', 1337),  

  admin: {

    auth: {

      secret: env('ADMIN_JWT_SECRET', 'dec1196c4a91c697f2d7bddb64548750'),

    },

  },

});

Ah right, that makes sense now. So it’s just the way that I misinterpreted your application path. You are right though: changing the server.js should be all that you need to do. I’m out of ideas, I’m afraid. Perhaps one of the Strapi experts can weigh in?

how do i reach out to them

You can try reaching out to them on Slack but tbh, it seems that we’re all relying on community support. I see many unanswered questions here and on the Slack channel.