diff --git a/app/api/auth/[...nextauth]/route.ts b/app/api/auth/[...nextauth]/route.ts index d4329461..829d8276 100644 --- a/app/api/auth/[...nextauth]/route.ts +++ b/app/api/auth/[...nextauth]/route.ts @@ -86,9 +86,9 @@ export const authOptions: NextAuthOptions = { // Initial sign in if (account && profile) { // Set user data from profile - token.username = profile.preferred_username; - token.first_name = profile.given_name; - token.last_name = profile.family_name; + token.username = profile.preferred_username || ''; + token.first_name = profile.given_name || ''; + token.last_name = profile.family_name || ''; token.role = profile.groups || []; // Get user info from Rocket.Chat using the admin token