@sap-ux/backend-proxy-middleware 0.7.6 → 0.7.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.
@@ -248,9 +248,8 @@ function enhanceConfigForSystem(proxyOptions, system, oAuthRequired, tokenChange
248
248
  refreshToken: system.refreshToken,
249
249
  refreshTokenChangedCb: tokenChangedCallback
250
250
  });
251
- // sending a request to the backend to get cookies
251
+ // sending a request to the backend to get token
252
252
  yield provider.getAtoInfo();
253
- proxyOptions.headers['cookie'] = provider.cookies.toString();
254
253
  }
255
254
  else {
256
255
  throw new Error('Cannot connect to ABAP Environment on BTP without service keys.');
@@ -306,11 +305,18 @@ function generateProxyMiddlewareOptions(backend, options = {}, logger = new logg
306
305
  const systemStore = yield (0, store_1.getService)({ logger, entityName: 'system' });
307
306
  const system = yield systemStore.read(new store_1.BackendSystemKey({ url: localBackend.url, client: localBackend.client }));
308
307
  if (system) {
309
- yield enhanceConfigForSystem(proxyOptions, system, backend.scp, (refreshToken) => {
308
+ yield enhanceConfigForSystem(proxyOptions, system, backend.scp, (refreshToken, accessToken) => {
310
309
  if (refreshToken) {
311
310
  logger.info('Updating refresh token for: ' + localBackend.url);
312
311
  systemStore.write(Object.assign(Object.assign({}, system), { refreshToken })).catch((error) => logger.error(error));
313
312
  }
313
+ if (accessToken) {
314
+ logger.info('Setting access token');
315
+ proxyOptions.headers['authorization'] = `bearer ${accessToken}`;
316
+ }
317
+ else {
318
+ logger.warn('Setting of access token failed.');
319
+ }
314
320
  });
315
321
  }
316
322
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Abackend-proxy-middleware"
11
11
  },
12
- "version": "0.7.6",
12
+ "version": "0.7.8",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -28,10 +28,10 @@
28
28
  "i18next": "20.6.1",
29
29
  "prompts": "2.4.2",
30
30
  "proxy-from-env": "1.1.0",
31
- "@sap-ux/axios-extension": "1.8.0",
32
- "@sap-ux/btp-utils": "0.12.1",
31
+ "@sap-ux/axios-extension": "1.8.1",
33
32
  "@sap-ux/logger": "0.4.0",
34
- "@sap-ux/store": "0.4.0"
33
+ "@sap-ux/store": "0.4.0",
34
+ "@sap-ux/btp-utils": "0.12.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/express": "4.17.17",