-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add setting for path where user is routed after successful authentication? #135
Comments
Here's my current oidc-callback view written in TypeScript with Vue 3: <script lang="ts">
import { defineComponent, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useStore } from '@/store';
import { useLogger } from '@/composables';
export default defineComponent({
name: 'OidcCallbackView',
setup(): void {
const store = useStore();
const router = useRouter();
const { logError } = useLogger();
onMounted(async () => {
try {
// Dispatch oidc signing callback store action
await store.dispatch('oidc/oidcSignInCallback');
// Route to home view
router.push({ name: 'home' });
} catch (error) {
// Custom error logging logic
logError('OidcCallbackView - dispatch oidcSignInCallback', error);
// Route to signin error view
router.push({ name: 'oidcCallbackError' });
}
});
},
});
</script>
<template>
<div>
<h5>
Processing authentication...
</h5>
</div>
</template> |
Or with the new experimental Script Setup syntax with Composition API: <script setup lang="ts">
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useStore } from '@/store';
import { useLogger } from '@/composables';
export const name = 'OidcCallbackView';
onMounted(async () => {
const store = useStore();
const router = useRouter();
const { logError } = useLogger();
try {
// Dispatch oidc signing callback store action
await store.dispatch('oidc/oidcSignInCallback');
// Route to home view
router.push({ name: 'home' });
} catch (error) {
// Log error
logError('OidcCallbackView - dispatch oidcSignInCallback', error);
// Route to signin error view
router.push({ name: 'oidcCallbackError' });
}
});
</script> |
Hello,
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This
redirectUri
configuration value has caused some confusion, which I'm quite sure has done so for others as well.Your example repo currently has this file
vuex-oidc-example/src/views/OidcCallback.vue
:So basically when user is routed to this view, vuex-oidc library redirects (if I understand correctly, at this point redir is done in auth guard level) to authentication server, which - if succesful - redirects back to this path and this view component.
Then this view executes created() hook and oidcSignInCallback() method here, which when succesfully returns
redirectPath
variable to the closure, which is pushed as the new path for the router.Isn't this
redirectPath
same as the configured path for this same route and view component - so nothing happens?Here I needed to switch
this.$router.push(redirectPath)
tothis.$router.push('/front')
...where, in my case, I want the user to be routed after successful authentication.Shouldn't there be a separate configuration value like
afterAuthenticatedRedirectUri
and/orafterAuthenticatedRedirectRoutePathName
?The text was updated successfully, but these errors were encountered: