Module: Legion::Extensions::MicrosoftTeams::Runners::Auth

Extended by:
Definitions
Includes:
Helpers::Lex, Helpers::Client
Included in:
Client
Defined in:
lib/legion/extensions/microsoft_teams/runners/auth.rb

Instance Method Summary collapse

Methods included from Helpers::Client

#bot_connection, #graph_connection, #oauth_connection, #user_path

Instance Method Details

#acquire_bot_token(client_id:, client_secret:, scope: 'https://api.botframework.com/.default') ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/legion/extensions/microsoft_teams/runners/auth.rb', line 26

def acquire_bot_token(client_id:, client_secret:,
                      scope: 'https://api.botframework.com/.default', **)
  response = oauth_connection(tenant_id: 'botframework.com').post('oauth2/v2.0/token', {
                                                                    grant_type:    'client_credentials',
                                                                    client_id:     client_id,
                                                                    client_secret: client_secret,
                                                                    scope:         scope
                                                                  })
  { result: response.body }
end

#acquire_token(tenant_id:, client_id:, client_secret:, scope: 'https://graph.microsoft.com/.default') ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/legion/extensions/microsoft_teams/runners/auth.rb', line 16

def acquire_token(tenant_id:, client_id:, client_secret:, scope: 'https://graph.microsoft.com/.default', **)
  response = oauth_connection(tenant_id: tenant_id).post('oauth2/v2.0/token', {
                                                           grant_type:    'client_credentials',
                                                           client_id:     client_id,
                                                           client_secret: client_secret,
                                                           scope:         scope
                                                         })
  { result: response.body }
end