From e1365c413413704aafb18082b261df267d258250 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 27 Apr 2024 14:13:56 +0800 Subject: [PATCH] :bug: Fix identity provide to livekit --- pkg/services/calls.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/services/calls.go b/pkg/services/calls.go index 46d0305..dc217ea 100644 --- a/pkg/services/calls.go +++ b/pkg/services/calls.go @@ -152,7 +152,6 @@ func EncodeCallToken(user models.Account, call models.Call) (string, error) { isAdmin = true } - identity := fmt.Sprintf("%d", user.ID) grant := &auth.VideoGrant{ Room: call.ExternalID, RoomJoin: true, @@ -161,7 +160,7 @@ func EncodeCallToken(user models.Account, call models.Call) (string, error) { duration := time.Second * time.Duration(viper.GetInt("calling.token_duration")) tk := auth.NewAccessToken(viper.GetString("calling.api_key"), viper.GetString("calling.api_secret")) - tk.AddGrant(grant).SetIdentity(identity).SetValidFor(duration) + tk.AddGrant(grant).SetIdentity(user.Name).SetValidFor(duration) return tk.ToJWT() }