Class: Agora::AgoraDynamicKey2::FpaTokenBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/agora/dynamic_key2/fpa_token_builder.rb

Class Method Summary collapse

Class Method Details

.build_token(app_id, app_certificate) ⇒ Object

Build the FPA token.

from your kit. See Get an App ID. See Get an App Certificate.

Parameters:

  • app_id

    The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing

  • app_certificate

    Certificate of the application that you registered in the Agora Dashboard.

Returns:

  • The FPA token.



11
12
13
14
15
16
17
18
19
# File 'lib/agora/dynamic_key2/fpa_token_builder.rb', line 11

def self.build_token(app_id, app_certificate)
  access_token = Agora::AgoraDynamicKey2::AccessToken.new(app_id, app_certificate, 24 * 3600)

  service_fpa = Agora::AgoraDynamicKey2::ServiceFpa.new
  service_fpa.add_privilege(Agora::AgoraDynamicKey2::ServiceFpa::, 0)
  access_token.add_service(service_fpa)

  access_token.build
end