{"action":"created","comment":{"url":"https://api.github.com/repos/strongloop/strong-remoting/pulls/comments/24890477","id":24890477,"diff_hunk":"@@ -55,6 +55,16 @@ describe('support for HTTP Authentication', function() {\n        fails('/digestAuth'));\n   });\n \n+  describe('remotes.auth', function () {\n+    it('should be populated from the url', function () {\n+      var credentials = 'foo:bar';\n+      var url = fmt('http://%s@myhost.com', credentials);","path":"test/auth.test.js","position":7,"original_position":7,"commit_id":"e55ce2bbbba7c03a7ca9abdbae42e8a55c2b2da8","original_commit_id":"e55ce2bbbba7c03a7ca9abdbae42e8a55c2b2da8","user":{"login":"bajtos","id":1140553,"avatar_url":"https://avatars.githubusercontent.com/u/1140553?v=3","gravatar_id":"","url":"https://api.github.com/users/bajtos","html_url":"https://github.com/bajtos","followers_url":"https://api.github.com/users/bajtos/followers","following_url":"https://api.github.com/users/bajtos/following{/other_user}","gists_url":"https://api.github.com/users/bajtos/gists{/gist_id}","starred_url":"https://api.github.com/users/bajtos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bajtos/subscriptions","organizations_url":"https://api.github.com/users/bajtos/orgs","repos_url":"https://api.github.com/users/bajtos/repos","events_url":"https://api.github.com/users/bajtos/events{/privacy}","received_events_url":"https://api.github.com/users/bajtos/received_events","type":"User","site_admin":false},"body":"Is there any particular reason for using `fmt` instead of including the credentials in the url string? Also `foo:bar` is not very descriptive,\r\n\r\nProposal:\r\n\r\n```js\r\nvar url = 'http://login:pass@myhost.com';\r\n```","created_at":"2015-02-18T10:07:18Z","updated_at":"2015-02-18T10:07:18Z","html_url":"https://github.com/strongloop/strong-remoting/pull/181#discussion_r24890477","pull_request_url":"https://api.github.com/repos/strongloop/strong-remoting/pulls/181","_links":{"self":{"href":"https://api.github.com/repos/strongloop/strong-remoting/pulls/comments/24890477"},"html":{"href":"https://github.com/strongloop/strong-remoting/pull/181#discussion_r24890477"},"pull_request":{"href":"https://api.github.com/repos/strongloop/strong-remoting/pulls/181"}}},"pull_request":{"url":"https://api.github.com/repos/strongloop/strong-remoting/pulls/181","id":29486554,"html_url":"https://github.com/strongloop/strong-remoting/pull/181","diff_url":"https://github.com/strongloop/strong-remoting/pull/181.diff","patch_url":"https://github.com/strongloop/strong-remoting/pull/181.patch","issue_url":"https://api.github.com/repos/strongloop/strong-remoting/issues/181","number":181,"state":"open","locked":false,"title":"Add remotes.auth / authorization support","user":{"login":"ritch","id":462228,"avatar_url":"https://avatars.githubusercontent.com/u/462228?v=3","gravatar_id":"","url":"https://api.github.com/users/ritch","html_url":"https://github.com/ritch","followers_url":"https://api.github.com/users/ritch/followers","following_url":"https://api.github.com/users/ritch/following{/other_user}","gists_url":"https://api.github.com/users/ritch/gists{/gist_id}","starred_url":"https://api.github.com/users/ritch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ritch/subscriptions","organizations_url":"https://api.github.com/users/ritch/orgs","repos_url":"https://api.github.com/users/ritch/repos","events_url":"https://api.github.com/users/ritch/events{/privacy}","received_events_url":"https://api.github.com/users/ritch/received_events","type":"User","site_admin":false},"body":"This adds a new feature (built on top of the existing auth support). Using `remotes.auth` you can now provide basic, bearer, and digest authorization (even after `remotes.connect()`).\r\n\r\nThis patch introduces the api (the `remotes.auth` property) and support in `HttpInvocation`. It maintains backwards compatibility by setting `remotes.auth` using the url provided in `remotes.connect()`.\r\n\r\nThe key new feature is that authorization can be set at any time and requests afterward will honor this setting. This makes it possible to do this:\r\n\r\n```js\r\nremotes.connect('http://localhost:3000');\r\n\r\nremotes.invoke('User.login', [{\r\n  username: 'foo',\r\n  password: 'bar'\r\n}], function(err, result) {\r\n  remotes.auth = {\r\n    bearer: result.accessToken\r\n  };\r\n});\r\n```\r\n\r\n...all subsequent invocations will be signed with the token.\r\n\r\n/to @raymondfeng \r\n/cc @rmg @bajtos \r\n\r\nFixes https://github.com/strongloop/strong-remoting/issues/105","created_at":"2015-02-17T23:05:20Z","updated_at":"2015-02-18T10:07:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86b9271a85ad2e2f0220623dbb8c25e59a1425f1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/strongloop/strong-remoting/pulls/181/commits","review_comments_url":"https://api.github.com/repos/strongloop/strong-remoting/pulls/181/comments","review_comment_url":"https://api.github.com/repos/strongloop/strong-remoting/pulls/comments/{number}","comments_url":"https://api.github.com/repos/strongloop/strong-remoting/issues/181/comments","statuses_url":"https://api.github.com/repos/strongloop/strong-remoting/statuses/e55ce2bbbba7c03a7ca9abdbae42e8a55c2b2da8","head":{"label":"strongloop:feature/authorization","ref":"feature/authorization","sha":"e55ce2bbbba7c03a7ca9abdbae42e8a55c2b2da8","user":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"repo":{"id":10045175,"name":"strong-remoting","full_name":"strongloop/strong-remoting","owner":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strongloop/strong-remoting","description":"Communicate between objects in servers, mobile apps, and other servers.","fork":false,"url":"https://api.github.com/repos/strongloop/strong-remoting","forks_url":"https://api.github.com/repos/strongloop/strong-remoting/forks","keys_url":"https://api.github.com/repos/strongloop/strong-remoting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongloop/strong-remoting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongloop/strong-remoting/teams","hooks_url":"https://api.github.com/repos/strongloop/strong-remoting/hooks","issue_events_url":"https://api.github.com/repos/strongloop/strong-remoting/issues/events{/number}","events_url":"https://api.github.com/repos/strongloop/strong-remoting/events","assignees_url":"https://api.github.com/repos/strongloop/strong-remoting/assignees{/user}","branches_url":"https://api.github.com/repos/strongloop/strong-remoting/branches{/branch}","tags_url":"https://api.github.com/repos/strongloop/strong-remoting/tags","blobs_url":"https://api.github.com/repos/strongloop/strong-remoting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongloop/strong-remoting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongloop/strong-remoting/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongloop/strong-remoting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongloop/strong-remoting/statuses/{sha}","languages_url":"https://api.github.com/repos/strongloop/strong-remoting/languages","stargazers_url":"https://api.github.com/repos/strongloop/strong-remoting/stargazers","contributors_url":"https://api.github.com/repos/strongloop/strong-remoting/contributors","subscribers_url":"https://api.github.com/repos/strongloop/strong-remoting/subscribers","subscription_url":"https://api.github.com/repos/strongloop/strong-remoting/subscription","commits_url":"https://api.github.com/repos/strongloop/strong-remoting/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongloop/strong-remoting/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongloop/strong-remoting/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongloop/strong-remoting/issues/comments/{number}","contents_url":"https://api.github.com/repos/strongloop/strong-remoting/contents/{+path}","compare_url":"https://api.github.com/repos/strongloop/strong-remoting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongloop/strong-remoting/merges","archive_url":"https://api.github.com/repos/strongloop/strong-remoting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongloop/strong-remoting/downloads","issues_url":"https://api.github.com/repos/strongloop/strong-remoting/issues{/number}","pulls_url":"https://api.github.com/repos/strongloop/strong-remoting/pulls{/number}","milestones_url":"https://api.github.com/repos/strongloop/strong-remoting/milestones{/number}","notifications_url":"https://api.github.com/repos/strongloop/strong-remoting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongloop/strong-remoting/labels{/name}","releases_url":"https://api.github.com/repos/strongloop/strong-remoting/releases{/id}","created_at":"2013-05-14T01:53:04Z","updated_at":"2015-02-17T22:53:11Z","pushed_at":"2015-02-17T22:59:39Z","git_url":"git://github.com/strongloop/strong-remoting.git","ssh_url":"git@github.com:strongloop/strong-remoting.git","clone_url":"https://github.com/strongloop/strong-remoting.git","svn_url":"https://github.com/strongloop/strong-remoting","homepage":"www.strongloop.com","size":3180,"stargazers_count":32,"watchers_count":32,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":17,"forks":29,"open_issues":17,"watchers":32,"default_branch":"master"}},"base":{"label":"strongloop:master","ref":"master","sha":"1189c0c4026961c5a922c1a9f94c8bd0f00d4840","user":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"repo":{"id":10045175,"name":"strong-remoting","full_name":"strongloop/strong-remoting","owner":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strongloop/strong-remoting","description":"Communicate between objects in servers, mobile apps, and other servers.","fork":false,"url":"https://api.github.com/repos/strongloop/strong-remoting","forks_url":"https://api.github.com/repos/strongloop/strong-remoting/forks","keys_url":"https://api.github.com/repos/strongloop/strong-remoting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongloop/strong-remoting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongloop/strong-remoting/teams","hooks_url":"https://api.github.com/repos/strongloop/strong-remoting/hooks","issue_events_url":"https://api.github.com/repos/strongloop/strong-remoting/issues/events{/number}","events_url":"https://api.github.com/repos/strongloop/strong-remoting/events","assignees_url":"https://api.github.com/repos/strongloop/strong-remoting/assignees{/user}","branches_url":"https://api.github.com/repos/strongloop/strong-remoting/branches{/branch}","tags_url":"https://api.github.com/repos/strongloop/strong-remoting/tags","blobs_url":"https://api.github.com/repos/strongloop/strong-remoting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongloop/strong-remoting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongloop/strong-remoting/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongloop/strong-remoting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongloop/strong-remoting/statuses/{sha}","languages_url":"https://api.github.com/repos/strongloop/strong-remoting/languages","stargazers_url":"https://api.github.com/repos/strongloop/strong-remoting/stargazers","contributors_url":"https://api.github.com/repos/strongloop/strong-remoting/contributors","subscribers_url":"https://api.github.com/repos/strongloop/strong-remoting/subscribers","subscription_url":"https://api.github.com/repos/strongloop/strong-remoting/subscription","commits_url":"https://api.github.com/repos/strongloop/strong-remoting/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongloop/strong-remoting/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongloop/strong-remoting/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongloop/strong-remoting/issues/comments/{number}","contents_url":"https://api.github.com/repos/strongloop/strong-remoting/contents/{+path}","compare_url":"https://api.github.com/repos/strongloop/strong-remoting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongloop/strong-remoting/merges","archive_url":"https://api.github.com/repos/strongloop/strong-remoting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongloop/strong-remoting/downloads","issues_url":"https://api.github.com/repos/strongloop/strong-remoting/issues{/number}","pulls_url":"https://api.github.com/repos/strongloop/strong-remoting/pulls{/number}","milestones_url":"https://api.github.com/repos/strongloop/strong-remoting/milestones{/number}","notifications_url":"https://api.github.com/repos/strongloop/strong-remoting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongloop/strong-remoting/labels{/name}","releases_url":"https://api.github.com/repos/strongloop/strong-remoting/releases{/id}","created_at":"2013-05-14T01:53:04Z","updated_at":"2015-02-17T22:53:11Z","pushed_at":"2015-02-17T22:59:39Z","git_url":"git://github.com/strongloop/strong-remoting.git","ssh_url":"git@github.com:strongloop/strong-remoting.git","clone_url":"https://github.com/strongloop/strong-remoting.git","svn_url":"https://github.com/strongloop/strong-remoting","homepage":"www.strongloop.com","size":3180,"stargazers_count":32,"watchers_count":32,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":17,"forks":29,"open_issues":17,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/strongloop/strong-remoting/pulls/181"},"html":{"href":"https://github.com/strongloop/strong-remoting/pull/181"},"issue":{"href":"https://api.github.com/repos/strongloop/strong-remoting/issues/181"},"comments":{"href":"https://api.github.com/repos/strongloop/strong-remoting/issues/181/comments"},"review_comments":{"href":"https://api.github.com/repos/strongloop/strong-remoting/pulls/181/comments"},"review_comment":{"href":"https://api.github.com/repos/strongloop/strong-remoting/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/strongloop/strong-remoting/pulls/181/commits"},"statuses":{"href":"https://api.github.com/repos/strongloop/strong-remoting/statuses/e55ce2bbbba7c03a7ca9abdbae42e8a55c2b2da8"}}}}