I'd like to hope that my library - https://github.com/simonh1000/elm-jwt - and examples there can help you Let me know Simon
On Saturday, 28 May 2016 00:50:25 UTC+2, Gage Peterson wrote: > > Basically this is just a matter of modeling the problem using model, > update, and subscriptions. You oculd save a request queue in your model and > toggle something to retry grabbing tokens. Once you receive one just have > that initiate the next one on the queue. There's no real way in Elm to hide > things under layers of abstraction or global state like in other languages. > Elm values being very explicit and transparent. > > Hopefully that helps you at least think through the problem. > > On Friday, May 27, 2016 at 8:18:31 AM UTC-6, Maximilian Hoffmann wrote: >> >> Hey there! >> >> What is a good way to handle http request authentication with the elm >> architecture? >> >> I need to get data from an API that requires a valid token for every >> request. Tokens expire after X minutes and should be refreshed, if a >> request fails with an authentication error. When the first request fails >> all subsequent requests initiated by the user should be stored and >> performed once a new valid token has been retrieved. (and the first failing >> one retried) >> >> My goal is to not repeat this logic in every module and have it somewhere >> “globally available” for the app. Anyone writing features should in the >> best case scenario just send a command and the token refreshing logic is >> behind some abstraction/in the root App component. >> >> >> Cheers, >> >> Max >> > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
