mirror of
https://github.com/plankanban/planka.git
synced 2026-02-05 00:39:58 +03:00
E_UNAUTHORIZED on (almost) all API endpoints #840
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @krylua on GitHub (Oct 15, 2025).
Where is the problem occurring?
I'm having issues using all API endpoints except /api/access-tokens, trying to use any other endpoint results in an E_UNAUTHORIZED "Access token is missing, invalid or expired" error message.
What browsers are you seeing the problem on?
N/A, I've tried with PowerShell and Python using the code snippets provided by Postman, adapting them to my environment. Code below.
Current behavior
I'm able to get a token from /api/access-tokens successfully, but then when I plug the token into the
<token>spot shown in Postman any other API calls fail with E_UNAUTHORIZED.Environment
Note: Data obfuscated for privacy purposes.
Docker
NGINX proxy.conf
PowerShell
Python
Troubleshooting
I added the following options to the Docker container in hopes of troubleshooting but unfortunately there has been no change. I'll admit to not fully understanding each setting, maybe I've misconfigured something:
I'm actually a bit annoyed with the lack of logs, even with the 'silly' setting, here's my current planka.log:
I made sure to stop/remove/recreate the container each time. I'll admit I'm pretty new to using APIs, but I've tried to format the token in many ways such as adding/removing
<>,"",'', etc. I've even passed it as a string variable, as can be seen in the PowerShell code, to no avail.Originally I was doing this all with the initial admin account, however I've created several users with different access rights and I get stuck at the same point each time. I've ensure each user has access to the project in question, etc. I've even double checked the datetime on my local machine, the host machine and the docker container and they all match.
I'm truly lost, could you please assist me? Any guidance would be greatly appreciated.
@meltyshev commented on GitHub (Oct 16, 2025):
Hi!
I just tested the Python version of the example script, and it works fine on my end. The only thing I noticed is that in the example, the token got split across two lines - probably just a copy-paste issue (otherwise the script wouldn't run at all).
I have a couple of quick questions:
Does authentication through the UI work correctly?
If it does, then the issue likely isn't related to the proxy configuration, since the frontend uses the same API.
How are you obtaining the
accessToken?If you're logging in through the UI, then copying the
accessTokenfrom the network response, it won't work - the frontend sendswithHttpOnlyToken=true, which means the generated token is only valid when paired with the correspondinghttpOnlycookie. This is done for additional security in browsers.To debug this, I'd recommend trying to get the token directly in your script. For example:
@krylua commented on GitHub (Oct 16, 2025):
Thanks for that information, this turned out to be the root cause. I was going by the v2 API documentation and both Swagger and Postman have
"withHttpOnlyToken": truedocumented for the/api/access-tokensendpoint.I think I did try commenting this out at some point, but it must've been when I was playing around with wrapping the token in different characters as it never worked for me.
For the sake of any future troubleshooters and to answer your other question, yes authentication worked via the frontend for all users.
Thank you for the assistance. Now to figure out how to submit a request to update the documentation.