{"action":"created","issue":{"url":"https://api.github.com/repos/dareid/chakram/issues/49","repository_url":"https://api.github.com/repos/dareid/chakram","labels_url":"https://api.github.com/repos/dareid/chakram/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/dareid/chakram/issues/49/comments","events_url":"https://api.github.com/repos/dareid/chakram/issues/49/events","html_url":"https://github.com/dareid/chakram/issues/49","id":155120590,"number":49,"title":"[Question] How do you build a request using basic auth","user":{"login":"mtaylorSF","id":808523,"avatar_url":"https://avatars.githubusercontent.com/u/808523?v=3","gravatar_id":"","url":"https://api.github.com/users/mtaylorSF","html_url":"https://github.com/mtaylorSF","followers_url":"https://api.github.com/users/mtaylorSF/followers","following_url":"https://api.github.com/users/mtaylorSF/following{/other_user}","gists_url":"https://api.github.com/users/mtaylorSF/gists{/gist_id}","starred_url":"https://api.github.com/users/mtaylorSF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtaylorSF/subscriptions","organizations_url":"https://api.github.com/users/mtaylorSF/orgs","repos_url":"https://api.github.com/users/mtaylorSF/repos","events_url":"https://api.github.com/users/mtaylorSF/events{/privacy}","received_events_url":"https://api.github.com/users/mtaylorSF/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-16T20:58:41Z","updated_at":"2016-05-19T10:03:12Z","closed_at":null,"body":"Can someone help out, i'm trying to add basic auth to a request\r\n\r\n```javascript\r\nvar chakram = require('chakram');\r\n    expect = chakram.expect;\r\n    \r\nvar requestHeader = {\r\n      \"Authorization\": \"Basic xxxx\",\r\n    };\r\n\r\ndescribe(\"Chakram\", function() {\r\n    it(\"should provide HTTP specific assertions\", function () {\r\n        var response = chakram.get(\"<host>\", requestHeader);\r\n        return expect(response).to.have.status(200);\r\n    });\r\n});\r\n```\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/dareid/chakram/issues/comments/220281199","html_url":"https://github.com/dareid/chakram/issues/49#issuecomment-220281199","issue_url":"https://api.github.com/repos/dareid/chakram/issues/49","id":220281199,"user":{"login":"yhuard","id":3524389,"avatar_url":"https://avatars.githubusercontent.com/u/3524389?v=3","gravatar_id":"","url":"https://api.github.com/users/yhuard","html_url":"https://github.com/yhuard","followers_url":"https://api.github.com/users/yhuard/followers","following_url":"https://api.github.com/users/yhuard/following{/other_user}","gists_url":"https://api.github.com/users/yhuard/gists{/gist_id}","starred_url":"https://api.github.com/users/yhuard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yhuard/subscriptions","organizations_url":"https://api.github.com/users/yhuard/orgs","repos_url":"https://api.github.com/users/yhuard/repos","events_url":"https://api.github.com/users/yhuard/events{/privacy}","received_events_url":"https://api.github.com/users/yhuard/received_events","type":"User","site_admin":false},"created_at":"2016-05-19T10:03:12Z","updated_at":"2016-05-19T10:03:12Z","body":"As [mentioned in the docs](https://dareid.github.io/chakram/jsdoc/module-chakram.html#.get), the second parameter of `chakram.get` corresponds to additional [request options](https://github.com/request/request#requestoptions-callback)\r\n\r\nYou can authenicate with either:\r\n\r\n```javascript\r\nvar options = {\r\n    headers: {\r\n        'Authorization': 'Basic xxxx'\r\n    }\r\n};\r\n```\r\n\r\nor:\r\n\r\n```javascript\r\nvar options = {\r\n    auth: {\r\n        user: 'yourusername',\r\n        password: 'yourpassword'\r\n    }\r\n};\r\n```\r\n\r\nAnd then call `var response = chakram.get(\"<host>\", options);`."}}