Hello,
Currently having a weird issue, while I have found a workaround, would like to have a better solution.
In a script I'm calling out to a custom internal API (a POST call) my company has on M3, which works just fine. The problem I've experienced in testing is that if a user steps away for a bit and their token expires/doesn't refresh properly, I get a POST error 401 for unauthorized (makes sense, auth token is void), but then something in a built in M3 script attempts to call the endpoint again but as a GET, which fails as 405 for method not allowed, as it's meant to be a POST. Hopefully that gives some insight into the issue. Wondering if there's a workaround to force a token refresh so that this error is avoided altogether.
My workaround is having the process retry if there's an error, a certain amount of times. The first call that errors does seem to force a token refresh, as in testing most times I've seen that the second attempt works as intended.
Looking for a better way overall to handle this. Thank you for your help.