When using OAuth2, my token expire in 1hr. I have a REFRESH_TOKEN to refresh the user token without running login flow again.
In Elm, is it possible to implement the refresh token flow as follow in http 2.0 package?
send API request
if success, return the cmd with success
if failed with 401
|> send refresh token request
|> send API request again with new token
|> return cmd batch [storeNewToken, apiDataSuccess]
if really failed, return cmd with failure
seems that this flow could construct by chaining tasks. but i have no idea how to do.