freshOS / ws-deprecated

⚠️ Deprecated - (in favour of Networking) :cloud: Elegantly connect to a JSON api. (Alamofire + Promises + JSON Parsing)
MIT License
353 stars 32 forks source link

REFRESH REQUEST #58

Open lernamanto opened 6 years ago

lernamanto commented 6 years ago

Hi, When interacting with OAuth Transparent token refresh is almost always desired.

As WS stands on the shoulder of Alamofire, and Alamofire v4 supports a new RequestRetrier protocol, how can I configure WS so that when my authentication token expires I get a new one and retry the request?

Thanks!

n13 commented 5 years ago

I have the same issue with Firebase bearer tokens, they also need to be refreshed and set as headers before each call.

Alamofire 5 will support an asynchronous version of RequestAdapter that will make a token refresh like that trivial. It also has retry but no need for that in this case.

Alamofire 4 has RequestAdapter and I'll add that to ws - that should be trivial to add. But it's not async in AF4 and so won't exactly work for the Firebase case, and I OAuth transparent token is similar.