I would like to intercept the Response if it has status 401, then use a RefreshToken to fetch a new AccessToken and then update the local user details and then retry the original request.
So I have set up the BaseClient with transformOptions and transformResult, in transformOptions I add the auth header to the request. And in transformResult I'm checking the result for 401, here I would like to refresh the access token and then send the original request again, but transformResult only gives the following parameters:
transformResult(url: string, response: Response, processor: (response: Response) => Promise<any>): Promise<any>
Please advise if this is possible and if you know a way to add this functionality to the client generated code. Thanks
Looking into doing the exact same thing :)
Does anyone have a nice solution for this?
Most helpful comment
Looking into doing the exact same thing :)