Method: Faraday::Connection#basic_auth

Defined in:
lib/faraday/connection.rb

#basic_auth(login, pass) ⇒ void

This method returns an undefined value.

Sets up the Authorization header with these credentials, encoded with base64.

Examples:


conn.basic_auth 'Aladdin', 'open sesame'
conn.headers['Authorization']
# => "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="

Parameters:

  • The authentication login.

  • The authentication password.



297
298
299
# File 'lib/faraday/connection.rb', line 297

def basic_auth(, pass)
  set_authorization_header(:basic_auth, , pass)
end