diff --git a/src/config/routes.tsx b/src/config/routes.tsx index 5afec547..8516e9c8 100644 --- a/src/config/routes.tsx +++ b/src/config/routes.tsx @@ -1,10 +1,17 @@ import { ENV } from './env' +const AUTH_SERVICE_URLS = { + preproduction: 'https://test-auth.instat.tv', + production: 'https://auth.instat.tv', + staging: 'https://test-auth.instat.tv', +} + const APIS = { preproduction: 'https://api-test.instat.tv', production: 'https://api.instat.tv', staging: 'https://api-staging.instat.tv', } +export const AUTH_SERVICE = AUTH_SERVICE_URLS[ENV] export const API_ROOT = APIS[ENV] export const DATA_URL = `${API_ROOT}/data` diff --git a/src/features/AuthStore/helpers.tsx b/src/features/AuthStore/helpers.tsx index 3966cdb3..4d1c6446 100644 --- a/src/features/AuthStore/helpers.tsx +++ b/src/features/AuthStore/helpers.tsx @@ -2,16 +2,15 @@ import type { UserManagerSettings } from 'oidc-client' import { WebStorageStateStore } from 'oidc-client' import { client } from 'config/clients' - -export const AUTH_PROVIDER_URL = 'https://auth.instat.tv' +import { AUTH_SERVICE } from 'config/routes' export const getClientSettings = (): UserManagerSettings => ({ - authority: AUTH_PROVIDER_URL, + authority: AUTH_SERVICE, automaticSilentRenew: true, client_id: client.auth.clientId, filterProtocolClaims: false, loadUserInfo: false, - metadataUrl: `${AUTH_PROVIDER_URL}/.well-known/openid-configuration${client.auth.metaDataUrlParams || ''}`, + metadataUrl: `${AUTH_SERVICE}/.well-known/openid-configuration${client.auth.metaDataUrlParams || ''}`, redirect_uri: `${window.origin}/redirect`, response_mode: 'query', response_type: 'id_token token', diff --git a/src/features/UserAccount/components/PersonalInfoForm/index.tsx b/src/features/UserAccount/components/PersonalInfoForm/index.tsx index 996a2716..085d9fb7 100644 --- a/src/features/UserAccount/components/PersonalInfoForm/index.tsx +++ b/src/features/UserAccount/components/PersonalInfoForm/index.tsx @@ -1,6 +1,6 @@ import { formIds } from 'config/form' +import { AUTH_SERVICE } from 'config/routes' -import { AUTH_PROVIDER_URL } from 'features/AuthStore/helpers' import { Combobox } from 'features/Combobox' import { Input } from 'features/Common' import { T9n } from 'features/T9n' @@ -111,7 +111,7 @@ export const PersonalInfoForm = (props: Props) => {