401 - API Token Required

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Posts: 1
Joined: 11 Feb 2021, 05:22

401 - API Token Required

Post by handras »

Mantis Bt version: 2.24.1
schema: 210
PHP: 7.3.26
dbVersion; 10.3.27, 10.3.27-MariaDB

Upon calling API I get HTTP 401 - API Token required.
I tried below steps. Any help is appreciated!

Took API endpoints from: https://documenter.getpostman.com/view/ ... pi/7Lt6zkP

Apache config:
<Directory "/var/www/my.localmantisdomain.com">
AllowOverride All
Require all granted

Mantis Config:
$g_webservice_rest_enabled = ON;

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

I tried to give full path to RewriteRule as flagged here:
Yet it did not resolve the issue. (I indeed got a Http500 if the path was incorrect, but leaving as index.php was working "well")
Posts: 1
Joined: 16 Apr 2021, 07:26

Re: 401 - API Token Required

Post by tchelopoa »

I was facing this same problem with Mantis Bt version 2.25.0.

I solved this issue adding the line to the /var/www/my.localmantisdomain.com/api/rest/.htaccess:
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0

I got this solution at https://www.mantisbt.org/bugs/view.php?id=26365
Post Reply