Skip to content

Commit b6997c9

Browse files
committed
fix: clear portainer-api-key cookie during session bootstrap
Portainer sets its own 'portainer-api-key' cookie when a user creates an API key. If this cookie exists with an expired or invalid key, Portainer prefers it over our JWT token and auto-login fails. Clear it alongside portainer_jwt and portainer.JWT during session bootstrap.
1 parent db62edd commit b6997c9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

apphub/src/services/integration_session_bridge.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ def bootstrap_portainer(self) -> list[dict[str, object]]:
231231
# carry an old unscoped portainer_jwt cookie may send it
232232
# alongside the new one, causing the gateway to pick up
233233
# a stale JWT.
234+
# portainer-api-key is set by Portainer itself when a user
235+
# creates an API key — an expired or invalid key in this
236+
# cookie takes precedence over our JWT and breaks auto-login.
234237
{
235238
"name": "portainer_jwt",
236239
"value": "",
@@ -244,6 +247,12 @@ def bootstrap_portainer(self) -> list[dict[str, object]]:
244247
"path": "/",
245248
"max_age": 0,
246249
},
250+
{
251+
"name": "portainer-api-key",
252+
"value": "",
253+
"path": "/",
254+
"max_age": 0,
255+
},
247256
]
248257
except CustomException:
249258
raise

0 commit comments

Comments
 (0)