Skip to content
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

feat: custom params for Keycloak #355

Merged
merged 4 commits into from
Feb 19, 2025

Conversation

BeSaad
Copy link
Contributor

@BeSaad BeSaad commented Feb 16, 2025

This PR helps to share data between the nuxt app and keycloak. Such as the user selected locale or the if dark mode is enabled or not.
It allows only direction: from your nuxt app to keycloak

Example

Lets take the example you want to sync the `locale` and the `dark` mode for your application

To send the information to keycloak, just use /auth/keycloak?dark=1&ui_locales=es then you can handle those params from your keycloak theme
Even better, Keycloak will automatically handle the ui_locales, you can then add the good class on yout html class for the dark mode

Now, during a login process, a user may change the dark mode or the locale in Keycloak, when he returns to your app, you want him to arrive with the correct theme and locale. For this, you need to redirect the user to your app when he updates locale or darkmode, save the state in your nuxt app, redirect again to keycloak (keep the redirect uri as request params)

This way you can have your keycloak and your nuxt app fully sync

@BeSaad BeSaad changed the title Create bridge between nuxt app and keycloak feat: custom params for Keycloak Feb 17, 2025
Copy link

pkg-pr-new bot commented Feb 19, 2025

Open in Stackblitz

npm i https://pkg.pr.new/atinux/nuxt-auth-utils@355

commit: 1ec007b

@atinux atinux merged commit 9c65b16 into atinux:main Feb 19, 2025
4 checks passed
@BeSaad BeSaad deleted the feat/keycloak-custom-bridge branch February 20, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants