title: Retry logic with different access token in Angular http client
body: <p>I have access token and refresh token for an API. One user can have different refresh tokens for different API, and I don't know how to manage access token when access token is expired.</p>
  <p>For now I solve it like this, but seems like it is a complex solution because I have to add it to all functions and when refresh token is expired It can't handle it.
  updateAccessToken function sends request to endpoint, get new access token and update it on state management system.</p>
  <pre><code>getAllBuckets(account: GetAllBucket){
      const {project, accessToken} = account
      const qs = new URLSearchParams({project})
      return this.http.get(`${this.urlGoogleStorage}?${qs.toString()}`, { headers: {Authorization: `Bearer ${accessToken}`}}).pipe(
        catchError((error) =&gt; {
          if(error.status == 401) this.auth.updateAccessToken(account);
          return throwError(() =&gt; error)
        })
      )
    }
  
  </code></pre>
  <p>Can anybody suggest better solution?</p>