widget chat 24
This commit is contained in:
parent
48d65028f1
commit
e2da8cfca4
@ -85,6 +85,12 @@ 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.role = profile.groups || [];
|
||||
|
||||
// Get user info from Rocket.Chat using the admin token
|
||||
const userInfoResponse = await fetch(`${process.env.ROCKET_CHAT_URL}/api/v1/users.info?username=${token.username}`, {
|
||||
headers: {
|
||||
|
||||
12
types/next-auth.d.ts
vendored
12
types/next-auth.d.ts
vendored
@ -40,10 +40,14 @@ declare module "next-auth" {
|
||||
}
|
||||
|
||||
interface Profile {
|
||||
given_name: string;
|
||||
family_name: string;
|
||||
preferred_username: string;
|
||||
realm_roles: string[];
|
||||
sub: string;
|
||||
email_verified: boolean;
|
||||
name?: string | null;
|
||||
preferred_username?: string | null;
|
||||
given_name?: string | null;
|
||||
family_name?: string | null;
|
||||
email?: string | null;
|
||||
groups?: string[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user