Module: LiveKit::AuthMixin

Included in:
EgressServiceClient, IngressServiceClient, RoomServiceClient
Defined in:
lib/livekit/auth_mixin.rb

Overview

Create authenticated headers when keys are provided

Instance Method Summary collapse

Instance Method Details

#auth_header(video_grant) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/livekit/auth_mixin.rb', line 6

def auth_header(video_grant)
  headers = {}
  t = ::LiveKit::AccessToken.new(api_key: @api_key, api_secret: @api_secret)
  t.add_grant(video_grant)
  headers["Authorization"] = "Bearer #{t.to_jwt}"
  headers["User-Agent"] = "LiveKit Ruby SDK"
  headers
end