Skip to content
Advertisement

Keycloak with nuxt-auth module

I’m using this auth-module with Keycloak.

My configuration in nuxt.config.js:

JavaScript

The connection is OK.

When I click on the “connect” button, I am redirected to my Keycloak environment. Once authenticated by Keycloak, I am redirected to my nuxt.js application.

However, the problem is that my store is empty. Do you have any ideas about what causes this problem?

loggedIn: is always false

user: is always null

Can you tell me why it doesn’t work?

Advertisement

Answer

I had similar issue, and was finally able to get it to work with the following configuration:

package.json

JavaScript

nuxt-config.json

JavaScript

Login function:

JavaScript

I had seen that GitHub had issues reported on the Nuxt Auth module, but was able to get it to work with this configuration. Hope this helps someone.

Advertisement