diff --git a/src/auth.js b/src/auth.js index 8c69f31..3a39040 100644 --- a/src/auth.js +++ b/src/auth.js @@ -1,8 +1,10 @@ -import { UserManager, WebStorageStateStore } from 'oidc-client-ts' +import {UserManager, WebStorageStateStore} from 'oidc-client-ts' const dev_settings = { userStore: new WebStorageStateStore({ store: window.localStorage }), authority: 'http://localhost:4011/', + loadUserInfo: true, + user_info_endpoint: 'http://localhost:4011/connect/userinfo', client_id: 'client-credentials-mock-client', client_secret: 'authorization-code-with-pkce-client-secret', redirect_uri: 'http://localhost:8080/login', @@ -108,22 +110,13 @@ class AuthService { return new Promise((resolve, reject) => { userManager.getUser() .then(user => { + console.log(user.access_token) resolve(user.access_token) }) .catch(error => reject(error)) }) } - async getClaims() { - const response = await fetch('http://localhost:4011/connect/userinfo', { - headers: - { - 'Authorization': 'Bearer ' + await this.getAccessToken() - } - }) - return response.json() - } - } diff --git a/src/store/actions.js b/src/store/actions.js index 1657728..a949721 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -1,11 +1,9 @@ import axios from 'axios' -const BASE_API_PATH = '/api/v3' - +let BASE_API_PATH = '/api/v3' const ACCESS_CRITERIA_PATH = `${BASE_API_PATH}/access-criteria/` const REQUESTS_PATH = `${BASE_API_PATH}/requests` const NEGOTIATION_PATH = `${BASE_API_PATH}/negotiations` - function getBearerHeaders(token) { return { headers: { diff --git a/src/views/HomePage.vue b/src/views/HomePage.vue index bca3700..2c058fc 100644 --- a/src/views/HomePage.vue +++ b/src/views/HomePage.vue @@ -62,13 +62,13 @@ export default { return { isUserLoggedIn: false, authToken: "", - userClaims: undefined, + profile: undefined, }; }, computed: { ...mapGetters({ notification: "getNotification" }), user() { - return this.userClaims !== undefined ? this.userClaims.name : ""; + return this.profile !== undefined ? this.profile.name : ""; }, }, methods: { @@ -82,7 +82,6 @@ export default { if (this.isUserLoggedIn) { this.authToken = await this.$auth.getAccessToken(); this.profile = await this.$auth.getProfile(); - this.userClaims = await this.$auth.getClaims(); } }, }; diff --git a/vite.config.js b/vite.config.js index 86d25a0..1b48701 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,7 +3,7 @@ import { fileURLToPath, URL } from "node:url"; import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; -const PROXY_TARGET = 'http://localhost:8090' +const PROXY_TARGET = 'http://localhost:8081' export default defineConfig({ plugins: [vue()],