REST API returns HTTP 404 error instead 401 for wrong API token

Form the documentation of Get project REST API endpoint Responses: 401 Returned if the authentication credentials are incorrect or missing.

I use Basic Authorization with username (email) and Jira API token. Last year, REST API has returned 401 error on wrong API token, but I get 404 “No project could be found with key …” nowadays.

Is this API behavior a bug? I need to distinguish these two cases - either API token is not valid or the project key is wrong. How to do it?

Note: even before the revoked API token has behaved as anonymous access, see this (unanswered) thread Revoked API token authenticates as anonymous access So, now, the REST API reaction got even worse.