-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Hello,
I am using the nuxt-oidc-auth
module in my Nuxt application and I’m wondering if it’s possible to redirect users back to the originally blocked URL after logging in via a provider (e.g., Keycloak), instead of redirecting them to a predefined page (e.g., redirectUri
).
In sidebase/nuxt-auth, there is an option addDefaultCallbackUrl
, which I tested, and it worked out of the box as expected. It is described in the documentation as follows:
addDefaultCallbackUrl
Type: boolean | string
Default: true
Whether to add a callbackUrl to sign in requests. Setting this to a string-value will result in that being used as the callbackUrl path. Setting this to true will result in the blocked original target path being chosen (if it can be determined).
Is this behavior possible with nuxt-oidc-auth
, or is there a way to achieve this through middleware?
Here are my current Nuxt settings:
oidc: {
defaultProvider: 'keycloak',
providers: {
keycloak: {
audience: 'account',
baseUrl: '',
clientId: '',
clientSecret: '',
redirectUri: 'http://localhost:3200/auth/keycloak/callback',
logoutRedirectUri: 'http://localhost:3200',
userNameClaim: 'name'
}
},
middleware: {
globalMiddlewareEnabled: true,
customLoginPage: false
},
session: {
expirationCheck: true,
automaticRefresh: true,
maxAge: 0,
cookie: {
sameSite: 'strict',
secure: true
}
}
}
I would prefer to use nuxt-oidc-auth as it works better for my use case and has more features, but I miss this functionality. Is there a way to replicate the behavior of sidebase/nuxt-auth, or can it be implemented via middleware?
Thanks in advance! I really appreciate all the hard work that has gone into this module - it’s been fantastic to work with.