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

Need to send the lang in the params as dynamic from the i18n package #943

Open
hadelnasr opened this issue Nov 13, 2024 · 3 comments
Open
Labels
bug A bug that needs to be resolved pending An issue waiting for triage

Comments

@hadelnasr
Copy link

Environment

Nuxt project info: 10:54:41 AM



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

@hadelnasr hadelnasr added bug A bug that needs to be resolved pending An issue waiting for triage labels Nov 13, 2024
@hadelnasr
Copy link
Author

@drusellers @zerekw @DavidDeSloovere @ayalon any update guys?

@hadelnasr
Copy link
Author

it's fixed by adding the lang as a parameter in the auth signIn function

await signIn("PROVIDER", {}, { lang: 'en' });

@drusellers
Copy link
Contributor

I just wrote my own and bailed on this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that needs to be resolved pending An issue waiting for triage
Projects
None yet
Development

No branches or pull requests

2 participants