🐛 Fix identity provide to livekit

This commit is contained in:
LittleSheep 2024-04-27 14:13:56 +08:00
parent d7e7dc9bfc
commit e1365c4134

View File

@ -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()
}