oidc-client-ts integration WIP
This commit is contained in:
parent
3c30049dc2
commit
be1e94ee06
@ -39,16 +39,17 @@ router.beforeEach(async (to, from) => {
|
|||||||
|
|
||||||
/* catch OIDC callback */
|
/* catch OIDC callback */
|
||||||
if (to.path === callbackPath) {
|
if (to.path === callbackPath) {
|
||||||
|
console.info("OIDC: got signin callback request to ", to);
|
||||||
const userMgr = getOidcUserManager();
|
const userMgr = getOidcUserManager();
|
||||||
try {
|
try {
|
||||||
const user = await userMgr.signinRedirectCallback();
|
const user = await userMgr.signinRedirectCallback(location.origin + to.fullPath);
|
||||||
console.log("OIDC: login complete, user: ", user);
|
console.info("OIDC: login complete, user: ", user);
|
||||||
storeInit(user);
|
storeInit(user);
|
||||||
/* redirect to home page */
|
|
||||||
return {name: 'home'};
|
|
||||||
} catch (err) {
|
} 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 */
|
/* if no user is logged in, we redirect to the home page */
|
||||||
|
@ -11,7 +11,7 @@ Log.level = (process.env.NODE_ENV === 'production') ? Log.ERROR : Log.DEBUG;
|
|||||||
// OIDC configuration
|
// OIDC configuration
|
||||||
const oidcProviderDomain = 'https://basebox-test-1.eu.auth0.com';
|
const oidcProviderDomain = 'https://basebox-test-1.eu.auth0.com';
|
||||||
const clientId = '5wl8hQV1thh07rScSoJ3aN56ETuXWprg';
|
const clientId = '5wl8hQV1thh07rScSoJ3aN56ETuXWprg';
|
||||||
const scopes = "openid profile email";
|
const scopes = "openid profile email name nickname";
|
||||||
export const callbackPath = "/auth/callback"
|
export const callbackPath = "/auth/callback"
|
||||||
|
|
||||||
/* OIDC UserManager singleton */
|
/* OIDC UserManager singleton */
|
||||||
@ -29,6 +29,7 @@ export const getOidcUserManager = () => {
|
|||||||
client_id: clientId,
|
client_id: clientId,
|
||||||
redirect_uri: window.location.origin + callbackPath,
|
redirect_uri: window.location.origin + callbackPath,
|
||||||
response_type: 'code',
|
response_type: 'code',
|
||||||
|
response_mode: 'query',
|
||||||
scope: scopes,
|
scope: scopes,
|
||||||
post_logout_redirect_uri: window.location.origin + '/home?action=logout',
|
post_logout_redirect_uri: window.location.origin + '/home?action=logout',
|
||||||
accessTokenExpiringNotificationTime: 10,
|
accessTokenExpiringNotificationTime: 10,
|
||||||
|
@ -19,7 +19,7 @@ function doLogin() {
|
|||||||
console.log("doLogin");
|
console.log("doLogin");
|
||||||
const userMgr = getOidcUserManager();
|
const userMgr = getOidcUserManager();
|
||||||
userMgr.signinRedirect().then(() => {
|
userMgr.signinRedirect().then(() => {
|
||||||
console.log("signinRedirect");
|
console.info("signinRedirect");
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error("signinRedirect failed", err);
|
console.error("signinRedirect failed", err);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user