Programmatically login via POST `/auth/local` with node.js / axios results 404

System Information
  • Strapi Version: 3.0.0-beta.17.4
  • Operating System: MacOS Catalina 10.15.7
  • Database: mongo
  • Node Version: 12.6.0
  • NPM Version: 6.9.0
  • Yarn Version: 1.22.10

:wave: My first post here.
I’m scraping my own strapi API via node.js/axios.
I’m following the Authenticated request doc page.

I get expected result fetching a /products GET route,
but I get a 404 when I try to fetch the /auth/local POST route in production.

I can login in the Admin panel ('/admin/auth/login) with the same credential I’m using in the node.js code, and I have the Roles & Permissions plugin installed.

While in the doc page the specified url is local dev environment ('http://localhost:1337/auth/local') I’m expecting that works for production too.

The documentation does not mention any difference between dev/production, maybe I am missing something?

This is my code:

import axios from 'axios'

const BASE_URL_API = ''

async function foo() {
  const { data: dataProducts } = await axios.get(`${BASE_URL_API}/products`)
  console.log({ dataProducts })
  // OK, everything works as expected
  const { data: dataLogin } = await`${BASE_URL_API}/auth/local`, {
    identifier: '',
    password: 'my-very-secret-password',
  // UnhandledPromiseRejectionWarning: Error: Request failed with status code 400



I think you forgot http / https in your base url:

Hi, I have the same issue. If I run my Strapi app v4 on localhost the /api/auth/local works (http://localhost:1337/api/auth/local), but if I run my app on Heroku on production I receive 400 bad request.

The others public api works.

The password file are not wrong.