You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug: Nous Portal OAuth device code flow — approval never propagates to token endpoint; _nous_api_key() rejects valid API keys
Summary
The OAuth device code flow for Nous Portal is broken: the verification URL shows a subscription plan page with no device approval UI, so the token endpoint never receives the approval signal. Additionally, _nous_api_key() in agent/auxiliary_client.py strictly validates tokens as JWTs, rejecting plain sk- API keys that the Portal's own API docs describe as the standard authentication method.
This blocks all Nous auxiliary tasks (compression, vision, skills_hub, etc.) for users who authenticate via API key.
Environment
Hermes Agent v0.16.0 (editable install)
Linux 6.8.0-110-generic
Nous Portal account: Plus plan ($20/mo, paid-up)
Steps to Reproduce
Run hermes auth add nous --no-browser --timeout 300
Hermes-side: _nous_api_key() in agent/auxiliary_client.py (line ~1278) only accepts JWT tokens via _nous_invoke_jwt_is_usable(). Plain sk- API keys fail with access_token_not_jwt, even though:
The Portal API docs specify API key auth as the standard method
The JWT-only fallback was also removed in 95cf8f984
Proposed Fix
In agent/auxiliary_client.py, update _nous_api_key() to accept sk- prefixed API keys without JWT validation:
def_nous_api_key(provider: dict) ->str:
"""Extract a usable Nous inference credential from stored auth state. Accepts both JWT tokens (minted by the Portal OAuth flow) and plain API keys (``sk-`` prefixed, generated on the Portal). The inference API treats both as valid bearer tokens. """fromhermes_cli.authimport_nous_invoke_jwt_is_usablefortoken_key, expiry_keyin (
("agent_key", "agent_key_expires_at"),
("access_token", "expires_at"),
):
token=provider.get(token_key)
ifnotisinstance(token, str) ornottoken.strip():
continue# Plain API keys (sk-...) are valid bearer tokens per the Portal# API docs — accept them without JWT validation.iftoken.startswith("sk-"):
returntokenif_nous_invoke_jwt_is_usable(
token,
scope=provider.get("scope"),
expires_at=provider.get(expiry_key),
):
returntokenreturn""
This is a minimal, backwards-compatible change — JWT tokens continue to work as before, and sk- API keys are additionally accepted.
Alternative / Longer-term
Fix the Portal's device code approval UI — the verification URL should show an "Approve Device" button, not a subscription page
Re-add nous-api as a provider (reverting 013cc4d2f) — gives users a proper setup wizard path for API key auth
At minimum, document that hermes auth add nous --type api-key is the recommended path when OAuth is unavailable
Bug: Nous Portal OAuth device code flow — approval never propagates to token endpoint;
_nous_api_key()rejects valid API keysSummary
The OAuth device code flow for Nous Portal is broken: the verification URL shows a subscription plan page with no device approval UI, so the token endpoint never receives the approval signal. Additionally,
_nous_api_key()inagent/auxiliary_client.pystrictly validates tokens as JWTs, rejecting plainsk-API keys that the Portal's own API docs describe as the standard authentication method.This blocks all Nous auxiliary tasks (compression, vision, skills_hub, etc.) for users who authenticate via API key.
Environment
Steps to Reproduce
hermes auth add nous --no-browser --timeout 300https://portal.nousresearch.com/manage-subscription?user_code=XXXX-XXXXWaiting for approval (polling every 1s)...authorization_pendingindefinitelyVerified with direct
curltesting:/api/oauth/device/code→ 200, returns device_code + user_code ✓/api/oauth/tokenwith device_code →authorization_pendingfor 150+ seconds, even after the user has signed into the Portal ✓What Works
sk-API key from the Portal works perfectly for direct inference:Root Cause
Two issues compound:
Portal-side: The device code verification URL (
/manage-subscription?user_code=...) does not present a device approval UI. The approval never reaches the token endpoint. (Related: [Bug]: Nous Portal OAuth device code flow fails on servers/headless environments (Vercel error 249) #12275 — device code flow also fails from servers due to Vercel WAF)Hermes-side:
_nous_api_key()inagent/auxiliary_client.py(line ~1278) only accepts JWT tokens via_nous_invoke_jwt_is_usable(). Plainsk-API keys fail withaccess_token_not_jwt, even though:nous-apias an API key provider, but it was removed in commit013cc4d2fwith the message: "Nous Portal only supports OAuth authentication"95cf8f984Proposed Fix
In
agent/auxiliary_client.py, update_nous_api_key()to acceptsk-prefixed API keys without JWT validation:This is a minimal, backwards-compatible change — JWT tokens continue to work as before, and
sk-API keys are additionally accepted.Alternative / Longer-term
nous-apias a provider (reverting013cc4d2f) — gives users a proper setup wizard path for API key authhermes auth add nous --type api-keyis the recommended path when OAuth is unavailableReferences
nous-apiprovider addition013cc4d2f— Removal ofnous-apiprovider