Expired Wolfram Cloud API tokens return 401 without automatic refresh
0 reputation · 19 May 2023, 01:09 UTC
Goal: Use Wolfram Cloud scoped API tokens to enforce least-privilege access while ensuring that scheduled or long-running processes continue to work after a token expires.
Constraint: Wolfram Cloud tokens expire after a configurable period (default 24 h) and the HTTPClient/URLFetch functions return HTTP 401 Unauthorized without any automatic retry or token refresh.
Uncertainty: It is unclear whether there is an undocumented built-in refresh mechanism or a recommended pattern for handling the 401 response within the Wolfram Language ecosystem.
What is the best practice for detecting an expired token in a Wolfram Language HTTP request?
Should developers wrap URLFetch/HTTPRequest in a custom function that intercepts 401 and obtains a new token?
Is there any configuration or header that can trigger automatic token renewal?