Wrong redirect by using vue-kecloak with quasar
See original GitHub issueFinally i got it working with quasar. But i got at least one problem: If i logged in i will be redirected to the following url which leads to the 404 quasar error page instead to http://192.168.178.44:8080/.
In the example vue3-keycloak it redirects correctly. I checked the router but i could not get the error source.
boot/keycloak.ts
import VueKeyCloak from '@dsb-norge/vue-keycloak-js'
import axios, { AxiosRequestConfig } from 'axios';
import { boot } from 'quasar/wrappers';
export default boot(async ({ app}) => {
function registerTokenInterceptor () {
axios.interceptors.request.use((config: AxiosRequestConfig) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/restrict-template-expressions
config.headers['Authorization'] = `Bearer ${app.config.globalProperties.$keycloak.token}`
return config
}, error => {
return Promise.reject(error)
}) //null, { synchronous: true })
}
return new Promise(resolve => {
app.use(VueKeyCloak, {
init: {
onLoad: 'check-sso', // or 'login-required'
flow: 'standard',
pkceMethod: 'S256',
silentCheckSsoRedirectUri: window.location.origin + '/silent-check-sso.html',
checkLoginIframe: false
},
config: {
url: 'https://my.keycloak.com/auth',
realm: 'myrealm',
clientId: 'myclientid',
},
onReady() {
registerTokenInterceptor()
resolve()
}
})
})
})
public/slient-check-sso.html
<html>
<body>
<script>
parent.postMessage(location.href, location.origin)
</script>
</body>
</html>
routes.ts
import { RouteRecordRaw } from 'vue-router';
const routes: RouteRecordRaw[] = [
{
path: '/',
component: () => import('layouts/MainLayout.vue'),
children: [{ path: '', component: () => import('pages/Index.vue') }],
},
// Always leave this as last one,
// but you can also remove it
{
path: '/:catchAll(.*)*',
component: () => import('pages/Error404.vue'),
},
];
export default routes;
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
hashmode leads into wrong redirect by using vue-keycloak ...
If i logged in i will be redirected to the following url which leads to the 404 quasar error page instead to http://192.168.178.44:8080/....
Read more >keycloak Invalid parameter: redirect_uri in quasar with ios
Consider either removing the redirect_uri parameter entirely or replacing it with the id_token_hint and post_logout_redirect_uri parameters.
Read more >Keycloak-js client with Quasar (now updated for v2)
I tried to create a Version for Quasar v.2. It works with only one redirection error. https://github.com/quasarframework/quasar/issues/10062.
Read more >pass data from one boot file to another - Quasar forum
Hello, I have defined two boot files, one for setting vue-keycloak for auth and the other for setting Vue-apollo. // boot/auth.js import ...
Read more >Boot files - Quasar Framework
A common use case for Quasar applications is to run code before the root Vue app ... The redirect() method accepts a String...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, trying resolving the same issue I come to the following solution in my router config code:
@Excel1 great! We should verify the problem and when that’s the case we have to create a ticket. I will check this too.
BR