Skip to content

Instantly share code, notes, and snippets.

@anuragmathur1
Last active July 14, 2017 02:19
Show Gist options
  • Save anuragmathur1/fc944cd72f00bc136b7d1d6c974c9b39 to your computer and use it in GitHub Desktop.
Save anuragmathur1/fc944cd72f00bc136b7d1d6c974c9b39 to your computer and use it in GitHub Desktop.
Generate Base64 encoded string for Authorization Header
username = 'xxxxxxxxxxxxx'
password = 'yyyyyyyyyyyyy'
base64_output_string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
auth_header = ("Authorization: Basic %s" % base64_output_string)
username = 'xxxxxxxxxxxxx'
password = 'yyyyyyyyyyyyy'
$auth_header = 'Authorization: Basic ' + Base64.encode64( username + ':' + password ).chomp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment