How to set Authorization headers asynchronously #820
-
|
I'm currently using Kingfisher and trying to switch to Nuke. All is going well except I'm currently stuck on how to correctly add Authorization headers to my requests. In Kingfisher I'm able to set a I came across #331 which was a step in the right direction except setting the header in this way only sets it on first call and then the Authorization header is fixed. This is a problem as our token expires and has to be refreshed by an async method. Ideally I need a way of intercepting each request that Nuke is about to make, and calling my async method that handles token retrieval/refresh and then returns that token to Nuke to be set on the I'm sure this must be doable as this is a pretty common requirement for requests. Any help would be hugely appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Would something like this not work (not tested) |
Beta Was this translation helpful? Give feedback.
There is a new async
func willLoadDatamethod inImagePipeline.Delegateadded in the upcoming major release (Nuke 13.0). More details in #772 (comment). I believe it should cover this use-case. Let me know if there is anything more I could add to support it better.