@oxyhq/core 3.4.6 → 3.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -602,7 +602,9 @@ class HttpService {
602
602
  * Build full URL with query params
603
603
  */
604
604
  buildURL(url, params) {
605
- const base = url.startsWith('http') ? url : `${this.baseURL}${url}`;
605
+ const base = /^https?:\/\//i.test(url)
606
+ ? url
607
+ : `${this.baseURL.replace(/\/+$/, '')}/${url.replace(/^\/+/, '')}`;
606
608
  if (!params || Object.keys(params).length === 0) {
607
609
  return base;
608
610
  }
@@ -115,6 +115,12 @@ class OxyServicesBase {
115
115
  const unsubscribe = this.onTokensChanged(syncToken);
116
116
  client.setAuthRefreshHandler(async (reason) => {
117
117
  const refreshed = await this.httpService.refreshAccessToken(reason);
118
+ if (!refreshed) {
119
+ if (reason === 'response-401') {
120
+ this.clearTokens();
121
+ }
122
+ return null;
123
+ }
118
124
  syncToken(refreshed);
119
125
  return refreshed;
120
126
  });