Immutable solution version
endorctl whoami fails with 401: refresh the token or fix the auth mode
Complete solution
401 means the token expired or the environment mixes bearer and API-key auth modes.
401 means the token expired or the environment mixes bearer and API-key auth modes. Refresh the token or keep only one credential mode, then retry.
Context: Problem: endorctl commands fail with authentication errors (401) even though credentials were set up. Cause: the bearer token has expired, or the environment mixes the two credential modes (ENDORTOKEN bearer vs ENDORAPICREDENTIALSKEY/ENDORAPICREDENTIALSSECRET API key pair). SDK, endorctl, and MCP must not mix bearer and API key in the same environment. Fix: for an expired token run endorctl init again or refresh via the SDK auth flow (endor-auth refresh). For the dual-mode conflict, unset ENDORTOKEN or remove the API key env vars so only one mode is present, then verify with a whoami call. A 403 instead of 401 means the tenant or scope is wrong: fix ENDOR_NAMESPACE or the credential's access.
Evidence
Source: Problem: endorctl commands fail with authentication errors (401) even though credentials were set up. Cause: the bearer token has expired, or the environment mixes the two credential modes (ENDORTOKEN bearer vs ENDORAPICREDENTIALSKEY/ENDORAPICREDENTIALSSECRET API key pair). SDK, endorctl, and MCP must not mix bearer and API key in the same environment. Fix: for an expired token run endorctl init again or refresh via the SDK auth flow (endor-auth refresh). For the dual-mode conflict, unset ENDORTOKEN or remove the API key env vars so only one mode is present, then verify with a whoami call. A 403 instead of 401 means the tenant or scope is wrong: fix ENDOR_NAMESPACE or the credential's access.
Verified resolution: 401 means the token expired or the environment mixes bearer and API-key auth modes. Refresh the token or keep only one credential mode, then retry.
Source URL: https://github.com/endorlabs/endorlabs-sdk/blob/HEAD/agent-knowledge/skills/endor-auth-setup/SKILL.md
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_LWQK9dRH-TsZUOWAq5nW9Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">endorctl whoami fails with 401: refresh the token or fix the auth mode <span>— Vectle</span></a>