jamf / mut

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API token timing out after around 30 minutes when updating large numbers of devices

neilmartin83 opened this issue · comments

When doing large runs to say over 1000 devices, that take longer than 30 minutes, we're finding that the auth token expires and device records stop updating.

In the logs:

2021-11-17 01:41:42 [INFO  ]: Submitting a PUT to https://REDACTED/JSSResource/mobiledevices/serialnumber/REDACTED
2021-11-17 01:41:43 [INFO  ]: Successful PUT completed. 201.
2021-11-17 01:41:43 [INFO  ]: <?xml version="1.0" encoding="UTF-8"?><mobile_device><id>2234</id></mobile_device>
2021-11-17 01:41:43 [INFO  ]: Submitting a request to to update the name of device REDACTED to 'REDACTED' with enforcement set to .
2021-11-17 01:41:43 [ERROR ]: Failed name enforcement request. 401.
2021-11-17 01:41:43 [ERROR ]: {
  "httpStatus" : 401,
  "errors" : [ {
    "code" : "INVALID_TOKEN",
    "description" : "Unauthorized",
    "id" : "0",
    "field" : null
  } ]
}

Could the token be periodically renewed during long runs to avoid this at all please?

Thank you.

For what it's worth, I've begun work on an auto-renew feature for the API token.

Unfortunately the MUT is currently using some endpoints that have been deprecated, which use Epoch time, and the new endpoints use a date/timestamp format expiry time, so I need to make some product decisions on how exactly to move forward with that... but automatic renewal is coming.

Auto renew of the token is now live!