Skip to content

Commit

Permalink
Auth in production
Browse files Browse the repository at this point in the history
  • Loading branch information
datajohnson committed Jul 24, 2024
1 parent 4fa6c97 commit c610b7d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 10 additions & 3 deletions src/web/auth-config.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
12 changes: 8 additions & 4 deletions src/web/src/plugins/auth.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit c610b7d

Please sign in to comment.