Module: Lightcast::Authentication

Included in:
Client
Defined in:
lib/lightcast-ruby/authentication.rb

Instance Method Summary collapse

Instance Method Details

#authenticateObject

rubocop:disable Metrics/MethodLength



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/lightcast-ruby/authentication.rb', line 5

def authenticate # rubocop:disable Metrics/MethodLength
  response = connection_auth.post('/connect/token',
                                  {
                                    client_id: @client_id,
                                    client_secret: @client_secret,
                                    grant_type: 'client_credentials',
                                    scope: @scope
                                  },
                                  {
                                    body: :form,
                                    content_type: 'application/x-www-form-urlencoded'
                                  })

  # Set the client values inline
  @access_token = response['access_token']

  # Give a chance to the invoker of the client to do something with the response
  response
end