Authentication error after migrating to forest-express-sequelize v7

Ok. I’ve managed to solve the issue with not being able to fetch clientId and now I’m back into issue with callback url not working. It seems to be caused by the fact that I have my admin panel hosted on /admin path and not the root url.

When Forest is available on http://localhost:8000/admin and APPLICATION_URL env variable is set to the same url, a call to authorization callback url returns 401. Please see the logs below:

http://localhost:8000/admin/forest/authentication/callback?code=PAp63joBSpWBDtfPgKHSlIS8JXr2Ux8AZOfksdqQ7HEwRM7aGnRJHC2Knj-85tpV&state=%7B%22renderingId%22%3A76844%7D

Request headers:

GET /admin/forest/authentication/callback?code=PAp63joBSpWBDtfPgKHSlIS8JXr2Ux8AZOfksdqQ7HEwRM7aGnRJHC2Knj-85tpV&state=%7B%22renderingId%22%3A76844%7D HTTP/1.1
Host: localhost:8000
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36
Content-Type: application/json; charset=utf-8
Accept: */*
Origin: https://app.forestadmin.com
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8

Response headers:

HTTP/1.1 401 Unauthorized
X-Powered-By: Express
Access-Control-Allow-Origin: https://app.forestadmin.com
Vary: Origin
Access-Control-Allow-Credentials: true
Content-Security-Policy: default-src 'none'
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 142
Date: Fri, 07 May 2021 12:13:11 GMT
Connection: keep-alive

Response:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>[object Object]</pre>
</body>
</html>

When I remove the /admin path all configs and put the admin interface on root url, everything works correctly.

The setup with /admin path was working correctly in forest-express-sequelize v6