Authentication Failed Error with unRAID 7.2.3
Environment
- unRAID Version: 7.2.3
- unRAID API Version: 4.28.2+d13a1f61
- Integration Version: 1.4.0
- Home Assistant Version: 2026.1.2
Problem Description
The integration fails to authenticate with "Authentication failed" error when setting up, even with a valid API key that has all required permissions (Info, Servers, Array, Disk, Share with Read permissions).
Logs
ERROR (MainThread) [custom_components.unraid_api.config_flow] GraphQL Error response: {'errors': [{'message': 'Forbidden resource', 'locations': [{'line': 3, 'column': 3}], 'path': ['info'], 'extensions': {'code': 'FORBIDDEN', 'originalError': {'message': 'Forbidden resource', 'error': 'Forbidden', 'statusCode': 403}}}], 'data': None}
The error shows a FORBIDDEN response code, but the integration treats this as a generic GraphQL error instead of an authentication error.
Root Cause
In /custom_components/unraid_api/api/__init__.py, the call_api method only checks for UNAUTHENTICATED errors but not FORBIDDEN errors:
if "errors" in result:
try:
if result["errors"][0]["extensions"]["code"] == "UNAUTHENTICATED":
raise UnraidAuthError(response=result)
except KeyError:
pass
raise UnraidGraphQLError(response=result)
Solution
Add handling for FORBIDDEN error code:
if "errors" in result:
try:
if result["errors"][0]["extensions"]["code"] == "UNAUTHENTICATED":
raise UnraidAuthError(response=result)
if result["errors"][0]["extensions"]["code"] == "FORBIDDEN":
raise UnraidAuthError(response=result)
except (KeyError, IndexError):
pass
raise UnraidGraphQLError(response=result)
Verification
After applying this fix, the integration successfully authenticates and connects to the unRAID server.
Additional Notes
The API key works correctly when tested directly with curl:
curl -H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" http://YOUR_SERVER/graphql -d '{"query":"{ info { versions { core { api } } } }"}'
This returns valid data, confirming the API key has proper permissions.
Authentication Failed Error with unRAID 7.2.3
Environment
Problem Description
The integration fails to authenticate with "Authentication failed" error when setting up, even with a valid API key that has all required permissions (Info, Servers, Array, Disk, Share with Read permissions).
Logs
The error shows a
FORBIDDENresponse code, but the integration treats this as a generic GraphQL error instead of an authentication error.Root Cause
In
/custom_components/unraid_api/api/__init__.py, thecall_apimethod only checks forUNAUTHENTICATEDerrors but notFORBIDDENerrors:Solution
Add handling for
FORBIDDENerror code:Verification
After applying this fix, the integration successfully authenticates and connects to the unRAID server.
Additional Notes
The API key works correctly when tested directly with curl:
This returns valid data, confirming the API key has proper permissions.