I'm just looking at the API response waiting for a...
# suitescript
c
I'm just looking at the API response waiting for a HTTP 401 which then triggers the script to request a new token then sends the same order again with the new bearer token - is this sane?
b
Sounds reasonable, hopefully you get a different error code if your credentials are revoked
s
Yes, if your code is modular.
b
You can probably add onto it if you need to manage the token more closely
s
If it were me, I'd have a separate API client class that handled authentication including token refresh behind the scenes - that sort of stuff shouldn't leak into your main business logic.
separation of concerns and all that good stuff
c
Same error code for bad auth or expired auth
not a big issue