Comments (3)
I think that to support server side rendering this plugin has to take more than just window
into account, because things like fetching the /config
from the site itself doesn't really make sense when the site is being rendered. It should really be done on the client, and therefore init must be done there as well. The problem here is that if the keycloak object is only created then, putting references to the $keycloak
property with things like login and logout into your code wouldn't resolve when being rendered. I believe this is why in @stevenferrer's case even when running the plugin on the client side only it still fails, and I tried running the plugin client side only on Gridsome and got the same issue. I would make a PR myself if this was an easy fix, but I can't think of a simple way of making this work.
from vue-keycloak-js.
You're right. The plugin doesn't take SSR into account. This is something I hope to get implemented. Can't really say when at the moment...
from vue-keycloak-js.
Here's my setup:
plugin/vue-keycloak.js
import Vue from 'vue'
import VueKeyCloak from '@dsb-norge/vue-keycloak-js'
// You can also pass in options. Check options reference below.
Vue.use(VueKeyCloak, {
config: {
url: 'http://keycloakserver/auth',
realm: 'my-realm',
clientId: 'my-client'
},
init: {
onLoad: 'login-required',
checkLoginIframe: false
},
onReady(keycloak) {
}
})
nuxt.config.js
{
...
plugins: [
{ src: '~/plugins/vue-keycloak.js', mode: 'client' }
]
...
}
I'm also getting warnings with Nuxt.js like the one below:
[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.
For now, I'm using the non-ssr mode of Nuxt to get around this.
Nuxt.js v2.11.0
Keycloak v8.0.1
from vue-keycloak-js.
Related Issues (20)
- Keycloak instance not available in vue3 HOT 2
- Keycloak - Ionic/Capacitor HOT 2
- URL fragments are not being removed upon successful login HOT 2
- For my keycloak version (18), the url configuration should not have "/auth" in the vite_vue3 example HOT 1
- $keycloak with vue 3 and vue-router 4 HOT 5
- Vue3 HOT 1
- Configurable token update interval
- The Vue 3 injection Symbol should be in a separate file and exported HOT 7
- Implementing PKCE with vue-keycloak-js HOT 2
- Always Redirect with URL #error=login_required HOT 3
- [vite] Internal server error: Failed to resolve import "@dsb-norge/vue-keycloak-js/dist/types" from "src/main.ts". Does the file exist? HOT 2
- [question] Where can I get an indication that the token has expired as a basis for jumping to the login
- Vue3 Support
- Support for Keycloak v21 HOT 1
- Cannot use namespace 'Keycloak' as a type HOT 2
- [question] Why and how do I prevent a blank page when the Keycloak server is not available? Vue, Keycloak, Quasar
- Refresh the system page and automatically add a hash parameter after the URL. How to remove the following parameters
- js-sha256 warning
- vue3 enable to use HRM HOT 1
- Vue Keycloak variable is undefined.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-keycloak-js.