widget chat 24
This commit is contained in:
parent
48d65028f1
commit
e2da8cfca4
@ -85,6 +85,12 @@ export const authOptions: NextAuthOptions = {
|
|||||||
|
|
||||||
// Initial sign in
|
// Initial sign in
|
||||||
if (account && profile) {
|
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
|
// 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}`, {
|
const userInfoResponse = await fetch(`${process.env.ROCKET_CHAT_URL}/api/v1/users.info?username=${token.username}`, {
|
||||||
headers: {
|
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 {
|
interface Profile {
|
||||||
given_name: string;
|
sub: string;
|
||||||
family_name: string;
|
email_verified: boolean;
|
||||||
preferred_username: string;
|
name?: string | null;
|
||||||
realm_roles: string[];
|
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