Need to send the lang in the params as dynamic from the i18n package
Environment
Nuxt project info: 10:54:41 AM
- Operating System: Linux
- Node Version: v22.3.0
- Nuxt Version: 3.13.2
- CLI Version: 3.13.2
- Nitro Version: 2.9.7
- Package Manager: [email protected]
- Builder: -
- User Config: imports, future, devtools, modules, auth, bootstrapVueNext, routeRules, i18n, $production, googleFonts, $development, runtimeConfig, build, css, compatibilityDate
- Runtime Modules: @bootstrap-vue-next/[email protected], [email protected], @nuxtjs/[email protected], maz-ui/nuxt, @vee-validate/[email protected], @nuxtjs/[email protected], @nuxt/test-utils/[email protected], @sidebase/[email protected], @nuxtjs/[email protected], @pinia/[email protected]
- Build Modules: -
Reproduction
i need to access the application localization state either from context or from cookie to be able to inject it in the params.lang value instead of sending it statically this way
Describe the bug
Here is my logic i'm adding in the [...].ts file
export default NuxtAuthHandler({ secret: runtimeConfig.authSecret, providers: [ { id: "SSO", name: "SSO", type: "oauth", wellKnown: runtimeConfig.ssoWellKnown, idToken: true, // Use ID token in the flow authorization: { url: runtimeConfig.ssoAuthorizationUrl, params: { scope: "openid profile offline_access nafeza_api", resource: "urn:egwin:api", lang: 'ar', }, }, clientId: runtimeConfig.nafezaClientId, clientSecret: runtimeConfig.nafezaClientSecret, debug: process.env.NODE_ENV === "development", profile(profile: any, account: any) { return { id: profile.sub, name: profile.profile.name, email: profile.profile.email }; }, }, ], debug: true, session: { maxAge: 30 * 24 * 60 * 60, // 30 days updateAge: 24 * 60 * 60, // 24 hours }, jwt: { secret: process.env.NUXT_API_SECRET, maxAge: 60 * 60, // 1 hour token expiry }, callbacks: { // @ts-ignore async jwt({ token, account }) { if (token && account?.id_token) { token.idToken = account.id_token; } if (token && account?.access_token) { token.accessToken = account.access_token; } return token; }, // @ts-ignore async session({ session, token }) { session.user.idToken = token.idToken; session.user.accessToken = token.accessToken; return session; }, }, // your authentication configuration here! events: { async signIn(message: object) { console.log("signIn event - message:", message); }, async signOut(message: object) { console.log("signOut event - message:", message); }, async createUser(message: object) { console.log("createUser event - message:", message); }, async updateUser(message: object) { console.log("updateUser event - message:", message); }, async linkAccount(message: object) { console.log("linkAccount event - message:", message); }, async session(message: object) { console.log("session event - message:", message); }, }, pages: { signIn: '/login' } })
i need to access the application localization state either from context or from cookie to be able to inject it in the params.lang value instead of sending it statically this way
Additional context
No response
Logs
No response
@drusellers @zerekw @DavidDeSloovere @ayalon any update guys?
it's fixed by adding the lang as a parameter in the auth signIn function
await signIn("PROVIDER", {}, { lang: 'en' });
I just wrote my own and bailed on this package.