{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/comments/40630911","id":40630911,"diff_hunk":"@@ -41,7 +41,7 @@ CREATE TABLE IF NOT EXISTS tokens (\n   FOREIGN KEY (clientId) REFERENCES clients(id) ON DELETE CASCADE,\n   userId BINARY(16) NOT NULL,\n   INDEX tokens_user_id(userId),\n-  email VARCHAR(256) NOT NULL,\n+  email VARCHAR(256),","path":"lib/db/mysql/schema.sql","position":5,"original_position":5,"commit_id":"0529a3666b0d69a891e999a0c64c5eb714c94a1d","original_commit_id":"0529a3666b0d69a891e999a0c64c5eb714c94a1d","user":{"login":"rfk","id":34695,"avatar_url":"https://avatars.githubusercontent.com/u/34695?v=3","gravatar_id":"","url":"https://api.github.com/users/rfk","html_url":"https://github.com/rfk","followers_url":"https://api.github.com/users/rfk/followers","following_url":"https://api.github.com/users/rfk/following{/other_user}","gists_url":"https://api.github.com/users/rfk/gists{/gist_id}","starred_url":"https://api.github.com/users/rfk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfk/subscriptions","organizations_url":"https://api.github.com/users/rfk/orgs","repos_url":"https://api.github.com/users/rfk/repos","events_url":"https://api.github.com/users/rfk/events{/privacy}","received_events_url":"https://api.github.com/users/rfk/received_events","type":"User","site_admin":false},"body":"I don't know about this intermediate state where some tokens can't fetch the email address...ISTM maybe we should go through with something like https://github.com/mozilla/fxa-auth-server/issues/1053 and then we can just drop this column entirely.\r\n\r\nIn fact, I wonder if we can deprecate having the email returned implicitly by /verify, and it's a bit of an abstraction violation anyway...","created_at":"2015-09-29T03:04:03Z","updated_at":"2015-09-29T03:04:03Z","html_url":"https://github.com/mozilla/fxa-oauth-server/pull/336#discussion_r40630911","pull_request_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/336","_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/comments/40630911"},"html":{"href":"https://github.com/mozilla/fxa-oauth-server/pull/336#discussion_r40630911"},"pull_request":{"href":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/336"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/336","id":44839928,"html_url":"https://github.com/mozilla/fxa-oauth-server/pull/336","diff_url":"https://github.com/mozilla/fxa-oauth-server/pull/336.diff","patch_url":"https://github.com/mozilla/fxa-oauth-server/pull/336.patch","issue_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues/336","number":336,"state":"open","locked":false,"title":"Service Client Tokens","user":{"login":"seanmonstar","id":51479,"avatar_url":"https://avatars.githubusercontent.com/u/51479?v=3","gravatar_id":"","url":"https://api.github.com/users/seanmonstar","html_url":"https://github.com/seanmonstar","followers_url":"https://api.github.com/users/seanmonstar/followers","following_url":"https://api.github.com/users/seanmonstar/following{/other_user}","gists_url":"https://api.github.com/users/seanmonstar/gists{/gist_id}","starred_url":"https://api.github.com/users/seanmonstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanmonstar/subscriptions","organizations_url":"https://api.github.com/users/seanmonstar/orgs","repos_url":"https://api.github.com/users/seanmonstar/repos","events_url":"https://api.github.com/users/seanmonstar/events{/privacy}","received_events_url":"https://api.github.com/users/seanmonstar/received_events","type":"User","site_admin":false},"body":"This currently works, posting an assertion to `/v1/token` with the right properties in the token will give you an access token.\r\n\r\n**One potential blocker** that has shown up implementing this:\r\n\r\n- Since the token is requested without an fxa-assertion, we cannot store the user's email address with the token, and therefore cannot fulfill requests to the profile server for `/v1/email`.\r\n\r\nCloses #328 \r\n\r\n-----\r\n\r\nMost of the missing parts are adding tests. I'm 99% sure that the code in `routes/token.js` no longer needs to be altered, but there's no explicit tests for many variables.\r\n\r\nTODO:\r\n\r\n- [ ] test wrong alg\r\n- [x] test unknown client\r\n- [x] test mismatched audience\r\n- [x] test invalid userid\r\n- [x] test issuedat in the future\r\n- [x] test expiresat in the past\r\n- [ ] test invalid signature\r\n- [x] test asking for more scopes\r\n- [x] test asking for less scopes\r\n","created_at":"2015-09-11T23:35:52Z","updated_at":"2015-09-29T03:04:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca1b86efaa8c26af44fcdb2a7ea828b793a0e86d","assignee":{"login":"rfk","id":34695,"avatar_url":"https://avatars.githubusercontent.com/u/34695?v=3","gravatar_id":"","url":"https://api.github.com/users/rfk","html_url":"https://github.com/rfk","followers_url":"https://api.github.com/users/rfk/followers","following_url":"https://api.github.com/users/rfk/following{/other_user}","gists_url":"https://api.github.com/users/rfk/gists{/gist_id}","starred_url":"https://api.github.com/users/rfk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfk/subscriptions","organizations_url":"https://api.github.com/users/rfk/orgs","repos_url":"https://api.github.com/users/rfk/repos","events_url":"https://api.github.com/users/rfk/events{/privacy}","received_events_url":"https://api.github.com/users/rfk/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mozilla/fxa-oauth-server/milestones/19","html_url":"https://github.com/mozilla/fxa-oauth-server/milestones/FxA-31:%20service%20tokens","labels_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/milestones/19/labels","id":1277101,"number":19,"title":"FxA-31: service tokens","description":"https://mozilla.aha.io/features/FXA-31","creator":{"login":"rfk","id":34695,"avatar_url":"https://avatars.githubusercontent.com/u/34695?v=3","gravatar_id":"","url":"https://api.github.com/users/rfk","html_url":"https://github.com/rfk","followers_url":"https://api.github.com/users/rfk/followers","following_url":"https://api.github.com/users/rfk/following{/other_user}","gists_url":"https://api.github.com/users/rfk/gists{/gist_id}","starred_url":"https://api.github.com/users/rfk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfk/subscriptions","organizations_url":"https://api.github.com/users/rfk/orgs","repos_url":"https://api.github.com/users/rfk/repos","events_url":"https://api.github.com/users/rfk/events{/privacy}","received_events_url":"https://api.github.com/users/rfk/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":2,"state":"open","created_at":"2015-08-28T07:05:39Z","updated_at":"2015-09-21T23:37:42Z","due_on":"2015-10-04T13:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/336/commits","review_comments_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/336/comments","review_comment_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues/336/comments","statuses_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/statuses/0529a3666b0d69a891e999a0c64c5eb714c94a1d","head":{"label":"mozilla:328-service-client-tokens","ref":"328-service-client-tokens","sha":"0529a3666b0d69a891e999a0c64c5eb714c94a1d","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":16819795,"name":"fxa-oauth-server","full_name":"mozilla/fxa-oauth-server","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/fxa-oauth-server","description":"OAuth server for Firefox Accounts","fork":false,"url":"https://api.github.com/repos/mozilla/fxa-oauth-server","forks_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/forks","keys_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/teams","hooks_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/events","assignees_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/tags","blobs_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/languages","stargazers_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/subscription","commits_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/merges","archive_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/downloads","issues_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/releases{/id}","created_at":"2014-02-13T22:41:50Z","updated_at":"2015-09-26T13:56:16Z","pushed_at":"2015-09-28T19:53:23Z","git_url":"git://github.com/mozilla/fxa-oauth-server.git","ssh_url":"git@github.com:mozilla/fxa-oauth-server.git","clone_url":"https://github.com/mozilla/fxa-oauth-server.git","svn_url":"https://github.com/mozilla/fxa-oauth-server","homepage":"","size":3386,"stargazers_count":18,"watchers_count":18,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":26,"forks":19,"open_issues":26,"watchers":18,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"613d3c5840d9c0bfc431cc16a22b39543e56c782","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":16819795,"name":"fxa-oauth-server","full_name":"mozilla/fxa-oauth-server","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/fxa-oauth-server","description":"OAuth server for Firefox Accounts","fork":false,"url":"https://api.github.com/repos/mozilla/fxa-oauth-server","forks_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/forks","keys_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/teams","hooks_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/events","assignees_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/tags","blobs_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/languages","stargazers_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/subscription","commits_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/merges","archive_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/downloads","issues_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/fxa-oauth-server/releases{/id}","created_at":"2014-02-13T22:41:50Z","updated_at":"2015-09-26T13:56:16Z","pushed_at":"2015-09-28T19:53:23Z","git_url":"git://github.com/mozilla/fxa-oauth-server.git","ssh_url":"git@github.com:mozilla/fxa-oauth-server.git","clone_url":"https://github.com/mozilla/fxa-oauth-server.git","svn_url":"https://github.com/mozilla/fxa-oauth-server","homepage":"","size":3386,"stargazers_count":18,"watchers_count":18,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":26,"forks":19,"open_issues":26,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/336"},"html":{"href":"https://github.com/mozilla/fxa-oauth-server/pull/336"},"issue":{"href":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues/336"},"comments":{"href":"https://api.github.com/repos/mozilla/fxa-oauth-server/issues/336/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/336/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/fxa-oauth-server/pulls/336/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/fxa-oauth-server/statuses/0529a3666b0d69a891e999a0c64c5eb714c94a1d"}}}}