http - Hubot Basic Authentication REST Call -


with hubot trying access specific issues through jira rest api.

url = http://myserver.com/jira/rest/api/2/search?jql=status="open"+and+assignee=null robot.http(url).get() (err, res, body) ->    # code 

hubot fails reach server. proxies set properly. rest api works expected through browser once logged in.

thus need specify authentication.

what tried far (plain basic authentication):

robot.http(url).auth('user', 'pass'). ...  robot.http(url).header('authentication', 'user:password'). ...  robot.http('http://user:password@someurl'). ... 

hubot keeps telling me server not found. how pass authentication through http?

this snippet hubot-confluence plugin should same authenticating jira. basic access authentication. can btoa method convert binary base64 encoded ascii. far know there lots of scripts connecting jira hubot.

make_headers = ->   user = nconf.get("hubot_confluence_user")   password = nconf.get("hubot_confluence_password")   auth = btoa("#{user}:#{password}")    ret =     accept: "application/json"     authorization: "basic #{auth}" 

and have correct making robot.http call

headers = make_headers() robot.http(url) .headers(headers) .get() (error, response, body) -> 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -