Failing to authenticate with the API

I am getting a 400 error: ValidationError “Invalid identifier or password”. I am not sure why this is. I checked my username and password. I even created a second user with a simple email and password. No luck. I am pulling from an .env file. It also fails when I paste the email and password directly into the code.

Note I am running on a server, not localhost.


response = requests.post(f"{strapi_server_url}/api/auth/local", 
                        headers={'Content-Type': 'application/json'}, 
                        json={'identifier': f"{admin_username}",
                              'password': f"{admin_password}",
                             })

Solved. The user was an administrator, not a common user. I created a common user and was able to authenticate.

1 Like

Hi :wave: how did you create a “common user” ?

The only roles I’m able to give are Super Admin, Author & Editor - all which lead to this error :confused:

Hey Aristide (and anyone that comes over here),

I too musunderstood that there are two realms of users.

You have the Adminitration users from the admin panel settings.
And you have a Users collection !

Users in the collection are the one used against /api/auth/local
Users of the admin panel are for the /admin/auth sepecific authentication.

Hope this clarifies !

2 Likes