{"action":"created","comment":{"url":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/comments/146874864","pull_request_review_id":71881860,"id":146874864,"diff_hunk":"@@ -70,9 +73,12 @@ exports.shouldUpdateToken = (token) ->\n ###\n exports.getAuthorizationHeader = Promise.method (token) ->\n \treturn if not token?\n-\ttoken.get().then (sessionToken) ->\n-\t\treturn if not sessionToken?\n-\t\treturn \"Bearer #{sessionToken}\"\n+\ttoken.hasKey().then (hasToken) ->\n+\t\tif !hasToken\n+\t\t\treturn\n+\t\ttoken.getKey().then (sessionToken) ->\n+\t\t\treturn if not sessionToken?\n+\t\t\treturn \"Bearer #{sessionToken}\"","path":"lib/utils.coffee","position":26,"original_position":26,"commit_id":"3a855fc6a45882790c4bb44dbdd8dae2696604c1","original_commit_id":"3a855fc6a45882790c4bb44dbdd8dae2696604c1","user":{"login":"pimterry","id":1526883,"avatar_url":"https://avatars0.githubusercontent.com/u/1526883?v=4","gravatar_id":"","url":"https://api.github.com/users/pimterry","html_url":"https://github.com/pimterry","followers_url":"https://api.github.com/users/pimterry/followers","following_url":"https://api.github.com/users/pimterry/following{/other_user}","gists_url":"https://api.github.com/users/pimterry/gists{/gist_id}","starred_url":"https://api.github.com/users/pimterry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pimterry/subscriptions","organizations_url":"https://api.github.com/users/pimterry/orgs","repos_url":"https://api.github.com/users/pimterry/repos","events_url":"https://api.github.com/users/pimterry/events{/privacy}","received_events_url":"https://api.github.com/users/pimterry/received_events","type":"User","site_admin":false},"body":"Some more debate: https://www.flowdock.com/app/rulemotion/resin-frontend/threads/lY3GgRC9VT07Crn7oRaNQrKauC-.\r\n\r\nConclusion: you authenticate with a 'token', which is either an 'api key', or a 'session token'.\r\n\r\nThat means:\r\n* We should use be using `Token` in most places here to refer to the value (which we're mostly already doing, conveniently)\r\n* `Key` refers to the actual string inside the token (as Ariel said above)\r\n* The instantiated module should be called `auth`, because it's `resin-auth`\r\n* If you have a case where you're only talking about one type specifically, it's either an 'api key', or a 'session token'","created_at":"2017-10-25T14:27:49Z","updated_at":"2017-10-25T14:27:49Z","html_url":"https://github.com/resin-io-modules/resin-request/pull/107#discussion_r146874864","pull_request_url":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/107","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/comments/146874864"},"html":{"href":"https://github.com/resin-io-modules/resin-request/pull/107#discussion_r146874864"},"pull_request":{"href":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/107"}},"in_reply_to_id":146855317},"pull_request":{"url":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/107","id":148360251,"html_url":"https://github.com/resin-io-modules/resin-request/pull/107","diff_url":"https://github.com/resin-io-modules/resin-request/pull/107.diff","patch_url":"https://github.com/resin-io-modules/resin-request/pull/107.patch","issue_url":"https://api.github.com/repos/resin-io-modules/resin-request/issues/107","number":107,"state":"open","locked":false,"title":"Update resin-request to use resin-auth, so that when it sends request…","user":{"login":"MoranF","id":5029459,"avatar_url":"https://avatars1.githubusercontent.com/u/5029459?v=4","gravatar_id":"","url":"https://api.github.com/users/MoranF","html_url":"https://github.com/MoranF","followers_url":"https://api.github.com/users/MoranF/followers","following_url":"https://api.github.com/users/MoranF/following{/other_user}","gists_url":"https://api.github.com/users/MoranF/gists{/gist_id}","starred_url":"https://api.github.com/users/MoranF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoranF/subscriptions","organizations_url":"https://api.github.com/users/MoranF/orgs","repos_url":"https://api.github.com/users/MoranF/repos","events_url":"https://api.github.com/users/MoranF/events{/privacy}","received_events_url":"https://api.github.com/users/MoranF/received_events","type":"User","site_admin":false},"body":"…s, they work with either the JWT or the API key\r\n\r\nConnects-To: #106\r\n\r\nChange-Type: major","created_at":"2017-10-24T10:45:07Z","updated_at":"2017-10-25T14:27:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd7f296549595979010377a09f11acd952c01764","assignee":{"login":"MoranF","id":5029459,"avatar_url":"https://avatars1.githubusercontent.com/u/5029459?v=4","gravatar_id":"","url":"https://api.github.com/users/MoranF","html_url":"https://github.com/MoranF","followers_url":"https://api.github.com/users/MoranF/followers","following_url":"https://api.github.com/users/MoranF/following{/other_user}","gists_url":"https://api.github.com/users/MoranF/gists{/gist_id}","starred_url":"https://api.github.com/users/MoranF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoranF/subscriptions","organizations_url":"https://api.github.com/users/MoranF/orgs","repos_url":"https://api.github.com/users/MoranF/repos","events_url":"https://api.github.com/users/MoranF/events{/privacy}","received_events_url":"https://api.github.com/users/MoranF/received_events","type":"User","site_admin":false},"assignees":[{"login":"MoranF","id":5029459,"avatar_url":"https://avatars1.githubusercontent.com/u/5029459?v=4","gravatar_id":"","url":"https://api.github.com/users/MoranF","html_url":"https://github.com/MoranF","followers_url":"https://api.github.com/users/MoranF/followers","following_url":"https://api.github.com/users/MoranF/following{/other_user}","gists_url":"https://api.github.com/users/MoranF/gists{/gist_id}","starred_url":"https://api.github.com/users/MoranF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoranF/subscriptions","organizations_url":"https://api.github.com/users/MoranF/orgs","repos_url":"https://api.github.com/users/MoranF/repos","events_url":"https://api.github.com/users/MoranF/events{/privacy}","received_events_url":"https://api.github.com/users/MoranF/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"thgreasi","id":1295829,"avatar_url":"https://avatars0.githubusercontent.com/u/1295829?v=4","gravatar_id":"","url":"https://api.github.com/users/thgreasi","html_url":"https://github.com/thgreasi","followers_url":"https://api.github.com/users/thgreasi/followers","following_url":"https://api.github.com/users/thgreasi/following{/other_user}","gists_url":"https://api.github.com/users/thgreasi/gists{/gist_id}","starred_url":"https://api.github.com/users/thgreasi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thgreasi/subscriptions","organizations_url":"https://api.github.com/users/thgreasi/orgs","repos_url":"https://api.github.com/users/thgreasi/repos","events_url":"https://api.github.com/users/thgreasi/events{/privacy}","received_events_url":"https://api.github.com/users/thgreasi/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/107/commits","review_comments_url":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/107/comments","review_comment_url":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/comments{/number}","comments_url":"https://api.github.com/repos/resin-io-modules/resin-request/issues/107/comments","statuses_url":"https://api.github.com/repos/resin-io-modules/resin-request/statuses/3a855fc6a45882790c4bb44dbdd8dae2696604c1","head":{"label":"resin-io-modules:106-use-resin-auth","ref":"106-use-resin-auth","sha":"3a855fc6a45882790c4bb44dbdd8dae2696604c1","user":{"login":"resin-io-modules","id":17724750,"avatar_url":"https://avatars0.githubusercontent.com/u/17724750?v=4","gravatar_id":"","url":"https://api.github.com/users/resin-io-modules","html_url":"https://github.com/resin-io-modules","followers_url":"https://api.github.com/users/resin-io-modules/followers","following_url":"https://api.github.com/users/resin-io-modules/following{/other_user}","gists_url":"https://api.github.com/users/resin-io-modules/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io-modules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io-modules/subscriptions","organizations_url":"https://api.github.com/users/resin-io-modules/orgs","repos_url":"https://api.github.com/users/resin-io-modules/repos","events_url":"https://api.github.com/users/resin-io-modules/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io-modules/received_events","type":"Organization","site_admin":false},"repo":{"id":32405844,"name":"resin-request","full_name":"resin-io-modules/resin-request","owner":{"login":"resin-io-modules","id":17724750,"avatar_url":"https://avatars0.githubusercontent.com/u/17724750?v=4","gravatar_id":"","url":"https://api.github.com/users/resin-io-modules","html_url":"https://github.com/resin-io-modules","followers_url":"https://api.github.com/users/resin-io-modules/followers","following_url":"https://api.github.com/users/resin-io-modules/following{/other_user}","gists_url":"https://api.github.com/users/resin-io-modules/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io-modules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io-modules/subscriptions","organizations_url":"https://api.github.com/users/resin-io-modules/orgs","repos_url":"https://api.github.com/users/resin-io-modules/repos","events_url":"https://api.github.com/users/resin-io-modules/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io-modules/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/resin-io-modules/resin-request","description":"Resin.io HTTP client.","fork":false,"url":"https://api.github.com/repos/resin-io-modules/resin-request","forks_url":"https://api.github.com/repos/resin-io-modules/resin-request/forks","keys_url":"https://api.github.com/repos/resin-io-modules/resin-request/keys{/key_id}","collaborators_url":"https://api.github.com/repos/resin-io-modules/resin-request/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/resin-io-modules/resin-request/teams","hooks_url":"https://api.github.com/repos/resin-io-modules/resin-request/hooks","issue_events_url":"https://api.github.com/repos/resin-io-modules/resin-request/issues/events{/number}","events_url":"https://api.github.com/repos/resin-io-modules/resin-request/events","assignees_url":"https://api.github.com/repos/resin-io-modules/resin-request/assignees{/user}","branches_url":"https://api.github.com/repos/resin-io-modules/resin-request/branches{/branch}","tags_url":"https://api.github.com/repos/resin-io-modules/resin-request/tags","blobs_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/refs{/sha}","trees_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/trees{/sha}","statuses_url":"https://api.github.com/repos/resin-io-modules/resin-request/statuses/{sha}","languages_url":"https://api.github.com/repos/resin-io-modules/resin-request/languages","stargazers_url":"https://api.github.com/repos/resin-io-modules/resin-request/stargazers","contributors_url":"https://api.github.com/repos/resin-io-modules/resin-request/contributors","subscribers_url":"https://api.github.com/repos/resin-io-modules/resin-request/subscribers","subscription_url":"https://api.github.com/repos/resin-io-modules/resin-request/subscription","commits_url":"https://api.github.com/repos/resin-io-modules/resin-request/commits{/sha}","git_commits_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/commits{/sha}","comments_url":"https://api.github.com/repos/resin-io-modules/resin-request/comments{/number}","issue_comment_url":"https://api.github.com/repos/resin-io-modules/resin-request/issues/comments{/number}","contents_url":"https://api.github.com/repos/resin-io-modules/resin-request/contents/{+path}","compare_url":"https://api.github.com/repos/resin-io-modules/resin-request/compare/{base}...{head}","merges_url":"https://api.github.com/repos/resin-io-modules/resin-request/merges","archive_url":"https://api.github.com/repos/resin-io-modules/resin-request/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/resin-io-modules/resin-request/downloads","issues_url":"https://api.github.com/repos/resin-io-modules/resin-request/issues{/number}","pulls_url":"https://api.github.com/repos/resin-io-modules/resin-request/pulls{/number}","milestones_url":"https://api.github.com/repos/resin-io-modules/resin-request/milestones{/number}","notifications_url":"https://api.github.com/repos/resin-io-modules/resin-request/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/resin-io-modules/resin-request/labels{/name}","releases_url":"https://api.github.com/repos/resin-io-modules/resin-request/releases{/id}","deployments_url":"https://api.github.com/repos/resin-io-modules/resin-request/deployments","created_at":"2015-03-17T16:32:55Z","updated_at":"2016-11-20T20:07:43Z","pushed_at":"2017-10-24T10:45:07Z","git_url":"git://github.com/resin-io-modules/resin-request.git","ssh_url":"git@github.com:resin-io-modules/resin-request.git","clone_url":"https://github.com/resin-io-modules/resin-request.git","svn_url":"https://github.com/resin-io-modules/resin-request","homepage":"","size":397,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"resin-io-modules:master","ref":"master","sha":"ca1cef5b744e9a0370c446fbce54a8fda68363e7","user":{"login":"resin-io-modules","id":17724750,"avatar_url":"https://avatars0.githubusercontent.com/u/17724750?v=4","gravatar_id":"","url":"https://api.github.com/users/resin-io-modules","html_url":"https://github.com/resin-io-modules","followers_url":"https://api.github.com/users/resin-io-modules/followers","following_url":"https://api.github.com/users/resin-io-modules/following{/other_user}","gists_url":"https://api.github.com/users/resin-io-modules/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io-modules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io-modules/subscriptions","organizations_url":"https://api.github.com/users/resin-io-modules/orgs","repos_url":"https://api.github.com/users/resin-io-modules/repos","events_url":"https://api.github.com/users/resin-io-modules/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io-modules/received_events","type":"Organization","site_admin":false},"repo":{"id":32405844,"name":"resin-request","full_name":"resin-io-modules/resin-request","owner":{"login":"resin-io-modules","id":17724750,"avatar_url":"https://avatars0.githubusercontent.com/u/17724750?v=4","gravatar_id":"","url":"https://api.github.com/users/resin-io-modules","html_url":"https://github.com/resin-io-modules","followers_url":"https://api.github.com/users/resin-io-modules/followers","following_url":"https://api.github.com/users/resin-io-modules/following{/other_user}","gists_url":"https://api.github.com/users/resin-io-modules/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io-modules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io-modules/subscriptions","organizations_url":"https://api.github.com/users/resin-io-modules/orgs","repos_url":"https://api.github.com/users/resin-io-modules/repos","events_url":"https://api.github.com/users/resin-io-modules/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io-modules/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/resin-io-modules/resin-request","description":"Resin.io HTTP client.","fork":false,"url":"https://api.github.com/repos/resin-io-modules/resin-request","forks_url":"https://api.github.com/repos/resin-io-modules/resin-request/forks","keys_url":"https://api.github.com/repos/resin-io-modules/resin-request/keys{/key_id}","collaborators_url":"https://api.github.com/repos/resin-io-modules/resin-request/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/resin-io-modules/resin-request/teams","hooks_url":"https://api.github.com/repos/resin-io-modules/resin-request/hooks","issue_events_url":"https://api.github.com/repos/resin-io-modules/resin-request/issues/events{/number}","events_url":"https://api.github.com/repos/resin-io-modules/resin-request/events","assignees_url":"https://api.github.com/repos/resin-io-modules/resin-request/assignees{/user}","branches_url":"https://api.github.com/repos/resin-io-modules/resin-request/branches{/branch}","tags_url":"https://api.github.com/repos/resin-io-modules/resin-request/tags","blobs_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/refs{/sha}","trees_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/trees{/sha}","statuses_url":"https://api.github.com/repos/resin-io-modules/resin-request/statuses/{sha}","languages_url":"https://api.github.com/repos/resin-io-modules/resin-request/languages","stargazers_url":"https://api.github.com/repos/resin-io-modules/resin-request/stargazers","contributors_url":"https://api.github.com/repos/resin-io-modules/resin-request/contributors","subscribers_url":"https://api.github.com/repos/resin-io-modules/resin-request/subscribers","subscription_url":"https://api.github.com/repos/resin-io-modules/resin-request/subscription","commits_url":"https://api.github.com/repos/resin-io-modules/resin-request/commits{/sha}","git_commits_url":"https://api.github.com/repos/resin-io-modules/resin-request/git/commits{/sha}","comments_url":"https://api.github.com/repos/resin-io-modules/resin-request/comments{/number}","issue_comment_url":"https://api.github.com/repos/resin-io-modules/resin-request/issues/comments{/number}","contents_url":"https://api.github.com/repos/resin-io-modules/resin-request/contents/{+path}","compare_url":"https://api.github.com/repos/resin-io-modules/resin-request/compare/{base}...{head}","merges_url":"https://api.github.com/repos/resin-io-modules/resin-request/merges","archive_url":"https://api.github.com/repos/resin-io-modules/resin-request/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/resin-io-modules/resin-request/downloads","issues_url":"https://api.github.com/repos/resin-io-modules/resin-request/issues{/number}","pulls_url":"https://api.github.com/repos/resin-io-modules/resin-request/pulls{/number}","milestones_url":"https://api.github.com/repos/resin-io-modules/resin-request/milestones{/number}","notifications_url":"https://api.github.com/repos/resin-io-modules/resin-request/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/resin-io-modules/resin-request/labels{/name}","releases_url":"https://api.github.com/repos/resin-io-modules/resin-request/releases{/id}","deployments_url":"https://api.github.com/repos/resin-io-modules/resin-request/deployments","created_at":"2015-03-17T16:32:55Z","updated_at":"2016-11-20T20:07:43Z","pushed_at":"2017-10-24T10:45:07Z","git_url":"git://github.com/resin-io-modules/resin-request.git","ssh_url":"git@github.com:resin-io-modules/resin-request.git","clone_url":"https://github.com/resin-io-modules/resin-request.git","svn_url":"https://github.com/resin-io-modules/resin-request","homepage":"","size":397,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/107"},"html":{"href":"https://github.com/resin-io-modules/resin-request/pull/107"},"issue":{"href":"https://api.github.com/repos/resin-io-modules/resin-request/issues/107"},"comments":{"href":"https://api.github.com/repos/resin-io-modules/resin-request/issues/107/comments"},"review_comments":{"href":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/107/comments"},"review_comment":{"href":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/resin-io-modules/resin-request/pulls/107/commits"},"statuses":{"href":"https://api.github.com/repos/resin-io-modules/resin-request/statuses/3a855fc6a45882790c4bb44dbdd8dae2696604c1"}},"author_association":"NONE"}}
{"actor":{"display_login":"pimterry"}}