Extend 'transformRequest' to accept an async function callback #5418
dannyleech
started this conversation in
Ideas
Replies: 2 comments
-
You could probably use |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks Harel, ' addProtocol' is a great tip, I imagine steps would be as follows
This looks like the best work around as it addresses both points above. But as you say perhaps a modification to transformRequest would make sense. I'm not familiar with the code base at all but will endeavour to take a look. Thanks again for this excellent suggestion! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The problem
I'm using a tile service that requires a short lived OAUTH token. My preferred approach would be to validate the token on each request. If the token has expired then use async await functionality to get a new token before completing the request/
I would expect transformRequest to accept and async function but I understand it doesn't.
My current workaround
Maintain a reference to the token and run a timer to update this just before it expires. However this appears quite fragile for several reasons:
Is there an alternative approach to address these issues or would an async transformRequest function be an idea worth exploring?
Beta Was this translation helpful? Give feedback.
All reactions