From be1e94ee0686da5a86fdbc50fbf17aa187674849 Mon Sep 17 00:00:00 2001 From: Markus Thielen Date: Wed, 1 Nov 2023 09:22:00 +0100 Subject: [PATCH] oidc-client-ts integration WIP --- src/router/index.js | 11 ++++++----- src/util/oidc.js | 3 ++- src/views/HomeView.vue | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index ff5c554..1b5b3f1 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -39,16 +39,17 @@ router.beforeEach(async (to, from) => { /* catch OIDC callback */ if (to.path === callbackPath) { + console.info("OIDC: got signin callback request to ", to); const userMgr = getOidcUserManager(); try { - const user = await userMgr.signinRedirectCallback(); - console.log("OIDC: login complete, user: ", user); + const user = await userMgr.signinRedirectCallback(location.origin + to.fullPath); + console.info("OIDC: login complete, user: ", user); storeInit(user); - /* redirect to home page */ - return {name: 'home'}; } catch (err) { - console.error("OIDC: login failed: ", err); + console.error("OIDC: Error handling signin callback: ", err); } + /* redirect to home page */ + return {name: 'home'}; } /* if no user is logged in, we redirect to the home page */ diff --git a/src/util/oidc.js b/src/util/oidc.js index 56ef3d1..4966f45 100644 --- a/src/util/oidc.js +++ b/src/util/oidc.js @@ -11,7 +11,7 @@ Log.level = (process.env.NODE_ENV === 'production') ? Log.ERROR : Log.DEBUG; // OIDC configuration const oidcProviderDomain = 'https://basebox-test-1.eu.auth0.com'; const clientId = '5wl8hQV1thh07rScSoJ3aN56ETuXWprg'; -const scopes = "openid profile email"; +const scopes = "openid profile email name nickname"; export const callbackPath = "/auth/callback" /* OIDC UserManager singleton */ @@ -29,6 +29,7 @@ export const getOidcUserManager = () => { client_id: clientId, redirect_uri: window.location.origin + callbackPath, response_type: 'code', + response_mode: 'query', scope: scopes, post_logout_redirect_uri: window.location.origin + '/home?action=logout', accessTokenExpiringNotificationTime: 10, diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 4f99f68..9b58253 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -19,7 +19,7 @@ function doLogin() { console.log("doLogin"); const userMgr = getOidcUserManager(); userMgr.signinRedirect().then(() => { - console.log("signinRedirect"); + console.info("signinRedirect"); }).catch((err) => { console.error("signinRedirect failed", err); });