diff --git a/src/web/auth-config.json b/src/web/auth-config.json index cfea169..8999287 100644 --- a/src/web/auth-config.json +++ b/src/web/auth-config.json @@ -1,5 +1,12 @@ { - "client_id": "XnOfIQeMeSXwM7SsmLXdvZxuwpgY5lAd", - "audience": "testing", - "domain": "https://dev-0tc6bn14.eu.auth0.com" + "development": { + "client_id": "XnOfIQeMeSXwM7SsmLXdvZxuwpgY5lAd", + "audience": "testing", + "domain": "https://dev-0tc6bn14.eu.auth0.com" + }, + "production": { + "client_id": "Li7cgKJiWZSxhjCQp2Gco1mGDcsO7WuU", + "audience": "generic-production", + "domain": "https://sign-in.service.yukon.ca" + } } diff --git a/src/web/src/plugins/auth.ts b/src/web/src/plugins/auth.ts index 3350528..c7e6746 100644 --- a/src/web/src/plugins/auth.ts +++ b/src/web/src/plugins/auth.ts @@ -1,5 +1,5 @@ import { createAuth0 } from "@auth0/auth0-vue"; -import { domain, client_id, audience } from "../../auth-config.json"; +import { production, development } from "../../auth-config.json"; // The "@auth0/auth0-vue" library composables to load and manage // authentication information. In components this information is available @@ -9,11 +9,15 @@ import { domain, client_id, audience } from "../../auth-config.json"; // of the way that composables work. So, the authStore loads in @/App.vue to // work around this issue. +let config = production; + +if (window.location.host == "localhost:8080") config = development; + export const AuthHelper = createAuth0({ - domain, - clientId: client_id, + domain: config.domain, + clientId: config.client_id, authorizationParams: { - audience, + audience: config.audience, redirect_uri: window.location.origin, }, // Uncomment the following line to use the config from .env file