Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 485 Bytes

authentication.md

File metadata and controls

32 lines (24 loc) · 485 Bytes

Authentication API

Authentication in Rocket.chat

login

require 'rocketchat'

rocket_server = RocketChat::Server.new('http://your.server.address/')
begin
  session = rocket_server.login('username', 'password')
rescue => e
  # Unauthorized or HTTPError, StatusError
  puts "reason: #{e.message}"
end

logout

require 'rocketchat'

begin
  # after login
  session.logout
rescue => e
  # [HTTPError, StatusError]
  puts "reason: #{e.message}"
end