From dad5bb1292f44aa840b48cceab6958571f181a6c Mon Sep 17 00:00:00 2001 From: Guillaume Weber <gweber@takima.fr> Date: Fri, 13 May 2022 17:10:13 +0200 Subject: [PATCH] fix: change config for mission registry url --- .../deadlock-extension/src/config.prod.ts | 2 +- .../deadlock-extension/src/config.staging.ts | 2 +- deadlock-plugins/deadlock-extension/src/config.ts | 2 +- .../src/core/callApi.service.ts | 15 +-------------- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/deadlock-plugins/deadlock-extension/src/config.prod.ts b/deadlock-plugins/deadlock-extension/src/config.prod.ts index 93648f3f..cf6b1eca 100644 --- a/deadlock-plugins/deadlock-extension/src/config.prod.ts +++ b/deadlock-plugins/deadlock-extension/src/config.prod.ts @@ -2,7 +2,7 @@ export const KEYCLOAK_DEVICE_AUTH_URL = 'https://auth.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/auth/device'; export const KEYCLOAK_TOKEN_CREATE_URL = 'https://auth.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/token'; export const KEYCLOAK_USER_INFO_URL = 'https://auth.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/userinfo'; -export const REGISTRY_MISSION_URL = 'registry.e-biz.fr/deadlock/deadlock-challenges'; +export const REGISTRY_MISSION_URL = 'registry.takima.io/deadlock/deadlock-challenges'; export const REJECT_UNAUTHORIZED = true; export const ENABLE_AUTOMATIC_SAVE = true; export const ENABLE_RECORDER_HTTP_SERVER = false; diff --git a/deadlock-plugins/deadlock-extension/src/config.staging.ts b/deadlock-plugins/deadlock-extension/src/config.staging.ts index 4067193b..912c56c2 100644 --- a/deadlock-plugins/deadlock-extension/src/config.staging.ts +++ b/deadlock-plugins/deadlock-extension/src/config.staging.ts @@ -4,7 +4,7 @@ export const KEYCLOAK_TOKEN_CREATE_URL = 'https://auth.staging.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/token'; export const KEYCLOAK_USER_INFO_URL = 'https://auth.staging.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/userinfo'; -export const REGISTRY_MISSION_URL = 'registry.e-biz.fr/deadlock/deadlock-challenges'; +export const REGISTRY_MISSION_URL = 'registry.takima.io/deadlock/deadlock-challenges'; export const REJECT_UNAUTHORIZED = true; export const ENABLE_AUTOMATIC_SAVE = true; export const ENABLE_RECORDER_HTTP_SERVER = false; diff --git a/deadlock-plugins/deadlock-extension/src/config.ts b/deadlock-plugins/deadlock-extension/src/config.ts index 850e35d0..21960df6 100644 --- a/deadlock-plugins/deadlock-extension/src/config.ts +++ b/deadlock-plugins/deadlock-extension/src/config.ts @@ -4,7 +4,7 @@ export const KEYCLOAK_TOKEN_CREATE_URL = 'https://auth.dev.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/token'; export const KEYCLOAK_USER_INFO_URL = 'https://auth.dev.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/userinfo'; -export const REGISTRY_MISSION_URL = 'registry.e-biz.fr/deadlock/deadlock-challenges'; +export const REGISTRY_MISSION_URL = 'registry.takima.io/deadlock/deadlock-challenges'; export const REJECT_UNAUTHORIZED = false; export const ENABLE_AUTOMATIC_SAVE = true; export const ENABLE_RECORDER_HTTP_SERVER = false; diff --git a/deadlock-plugins/deadlock-extension/src/core/callApi.service.ts b/deadlock-plugins/deadlock-extension/src/core/callApi.service.ts index ad487aab..afbd314b 100644 --- a/deadlock-plugins/deadlock-extension/src/core/callApi.service.ts +++ b/deadlock-plugins/deadlock-extension/src/core/callApi.service.ts @@ -29,15 +29,6 @@ export default class CallApiService { this.callApi.interceptors.request.use( async (config) => { let accessToken = await this.extensionStore.getAccessToken(); - - if (!accessToken) { - try { - this.controller.authenticate(); - accessToken = await this.extensionStore.getAccessToken(); - } catch (_error) { - return Promise.reject(_error); - } - } if (accessToken && config.headers) { config.headers['authorization'] = `BEARER ${accessToken}`; } @@ -77,11 +68,7 @@ export default class CallApiService { } else if (originalConfig._retry) { // IF REFRESH TOKEN NOT WORK, REQUEST NEW CONNECTION IN USER BROWSER try { - const { accessToken, refreshToken } = await this.keycloackConnection.getToken({ - openLink: Controller.openBrowserWithUrl, - }); - await this.extensionStore.setAccessToken(accessToken); - await this.extensionStore.setRefreshToken(refreshToken); + await this.controller.authenticate(); return this.callApi(originalConfig); } catch (_error) { return Promise.reject(_error); -- GitLab