Class: Citadel::Authenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/citadel-ruby-client/authenticator.rb

Instance Method Summary collapse

Instance Method Details

#get_token(login, password) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/citadel-ruby-client/authenticator.rb', line 7

def get_token(, password)
  matrix_paths = MatrixPaths.new
  url = matrix_paths.base_uri + matrix_paths.
  data_hash = { type: 'm.login.password', user: , password: password }
  data = JSON.generate data_hash
  response = HTTP.post(url, body: data)
  JSON.parse(response.body)['access_token']
end