Module: LiveKit::AuthMixin

Included in:
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



4
5
6
7
8
9
10
# File 'lib/livekit/auth_mixin.rb', line 4

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
end