{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/comments/59863561","id":59863561,"diff_hunk":"@@ -1525,6 +1640,51 @@ Content-Length: 2\n     * Body : {\"code\":\"InternalError\",\"message\":\"...<message related to the error>...\"}\n * ``\n \n+## verifyToken : `POST /token/<tokenVerificationId>/verify`\n+\n+This method verifies sessionTokens and keyFetchTokens.\n+Note that it takes the tokenVerificationId\n+specified when creating the token,\n+NOT the tokenId.\n+\n+### Example\n+\n+```\n+curl \\\n+    -v \\\n+    -X POST \\\n+    -H \"Content-Type: application/json\" \\\n+    -d '{}' \\\n+    http://localhost:8000/token/266fd690895c8b0086bb2c83e4b3b41c128746125f28b5429938765279673d62/verify\n+```\n+\n+### Request\n+\n+* Method : POST\n+* Path : `/token/<tokenVerificationId>/verify`\n+    * tokenVerificationId : hex256\n+* Params:\n+    * tries : int\n+\n+### Response\n+\n+```\n+HTTP/1.1 200 OK\n+Content-Type: application/json\n+Content-Length: 2\n+\n+{}\n+```\n+\n+* Status Code : 200 OK\n+    * Content-Type : 'application/json'\n+    * Body : {}\n+* Status Code : 500 Internal Server Error","path":"fxa-auth-db-server/docs/API.md","position":279,"original_position":225,"commit_id":"cb3dbbfdffde6fca6e5a11dfbff8d9fe820755fe","original_commit_id":"7d0f494bb75092359fd336accf96b00f7db4a035","user":{"login":"shane-tomlinson","id":848085,"avatar_url":"https://avatars.githubusercontent.com/u/848085?v=3","gravatar_id":"","url":"https://api.github.com/users/shane-tomlinson","html_url":"https://github.com/shane-tomlinson","followers_url":"https://api.github.com/users/shane-tomlinson/followers","following_url":"https://api.github.com/users/shane-tomlinson/following{/other_user}","gists_url":"https://api.github.com/users/shane-tomlinson/gists{/gist_id}","starred_url":"https://api.github.com/users/shane-tomlinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane-tomlinson/subscriptions","organizations_url":"https://api.github.com/users/shane-tomlinson/orgs","repos_url":"https://api.github.com/users/shane-tomlinson/repos","events_url":"https://api.github.com/users/shane-tomlinson/events{/privacy}","received_events_url":"https://api.github.com/users/shane-tomlinson/received_events","type":"User","site_admin":false},"body":">  The alternative would be to redirect those users to some kind of \"link expired\" view\r\n\r\nWe have link expired errors for signup and password reset tokens.","created_at":"2016-04-15T11:55:50Z","updated_at":"2016-04-15T11:55:50Z","html_url":"https://github.com/mozilla/fxa-auth-db-mysql/pull/132#discussion_r59863561","pull_request_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/132","_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/comments/59863561"},"html":{"href":"https://github.com/mozilla/fxa-auth-db-mysql/pull/132#discussion_r59863561"},"pull_request":{"href":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/132"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/132","id":66324651,"html_url":"https://github.com/mozilla/fxa-auth-db-mysql/pull/132","diff_url":"https://github.com/mozilla/fxa-auth-db-mysql/pull/132.diff","patch_url":"https://github.com/mozilla/fxa-auth-db-mysql/pull/132.patch","issue_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues/132","number":132,"state":"open","locked":false,"title":"feat(db): implement new token verification logic","user":{"login":"philbooth","id":64367,"avatar_url":"https://avatars.githubusercontent.com/u/64367?v=3","gravatar_id":"","url":"https://api.github.com/users/philbooth","html_url":"https://github.com/philbooth","followers_url":"https://api.github.com/users/philbooth/followers","following_url":"https://api.github.com/users/philbooth/following{/other_user}","gists_url":"https://api.github.com/users/philbooth/gists{/gist_id}","starred_url":"https://api.github.com/users/philbooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philbooth/subscriptions","organizations_url":"https://api.github.com/users/philbooth/orgs","repos_url":"https://api.github.com/users/philbooth/repos","events_url":"https://api.github.com/users/philbooth/events{/privacy}","received_events_url":"https://api.github.com/users/philbooth/received_events","type":"User","site_admin":false},"body":"This covers all of the database changes for FxA-83, sign-in confirmation. I realise the feature document isn't actually finished yet but, as I'd already made a start on this, I wanted to get it into review so that nobody is blocked from working on other parts of the feature.\r\n\r\nThe approach taken is based on (my understanding of) @dannycoates' recommendation from the Google Doc:\r\n\r\n* A new table is added, `unverifiedTokens`, and the create/delete stored procedures for `sessionTokens` and `keyFetchTokens` maintain it appropriately. ~~Fwiw, as things stand, the first cut of the auth server changes may not utilise the `keyFetchTokens` part of this, but a second version that does so should follow pretty rapidly.~~\r\n\r\n* New endpoints, `GET /sessionToken/:id/verified` and `GET keyFetchToken/:id/verified`, are added for checking a token's verification state, which is returned in a field called `tokenVerified`. This has changed from `isVerified` in the original document, to better disambiguate it from the `emailVerified` field.\r\n\r\n* A third new endpoint, `POST /token/:tokenVerificationId/verify` is added for verifying tokens. I briefly toyed with the idea of implementing this as `DELETE /unverifiedToken/:tokenVerificationId`, in an effort to fit what actually happens in the database. But I figured the extra table is just an implementation detail and naming the stored procedure `verifyToken` better reflects what is happening from the caller's point of view.\r\n\r\n@vbudhram @dannycoates @rfk, feedback appreciated.\r\n\r\n/cc @shane-tomlinson \r\n","created_at":"2016-04-13T13:52:11Z","updated_at":"2016-04-15T11:55:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c57f97e5fc24ecfa0a1f6a82e68d1fb70edbe88","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/132/commits","review_comments_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/132/comments","review_comment_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues/132/comments","statuses_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/statuses/cb3dbbfdffde6fca6e5a11dfbff8d9fe820755fe","head":{"label":"mozilla:phil/fxa-83","ref":"phil/fxa-83","sha":"cb3dbbfdffde6fca6e5a11dfbff8d9fe820755fe","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":23937466,"name":"fxa-auth-db-mysql","full_name":"mozilla/fxa-auth-db-mysql","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-auth-db-mysql","description":"MySql backend for the fxa-auth-db-server","fork":false,"url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql","forks_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/forks","keys_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/teams","hooks_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/hooks","issue_events_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/events","assignees_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/tags","blobs_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/languages","stargazers_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/stargazers","contributors_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/contributors","subscribers_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/subscribers","subscription_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/subscription","commits_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/merges","archive_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/downloads","issues_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/deployments","created_at":"2014-09-11T22:06:52Z","updated_at":"2016-01-11T04:47:05Z","pushed_at":"2016-04-15T11:25:33Z","git_url":"git://github.com/mozilla/fxa-auth-db-mysql.git","ssh_url":"git@github.com:mozilla/fxa-auth-db-mysql.git","clone_url":"https://github.com/mozilla/fxa-auth-db-mysql.git","svn_url":"https://github.com/mozilla/fxa-auth-db-mysql","homepage":"","size":636,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":5,"forks":13,"open_issues":5,"watchers":4,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"a0522c1eda66f9fa92073f4f99959af78dec3490","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":23937466,"name":"fxa-auth-db-mysql","full_name":"mozilla/fxa-auth-db-mysql","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-auth-db-mysql","description":"MySql backend for the fxa-auth-db-server","fork":false,"url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql","forks_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/forks","keys_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/teams","hooks_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/hooks","issue_events_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/events","assignees_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/tags","blobs_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/languages","stargazers_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/stargazers","contributors_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/contributors","subscribers_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/subscribers","subscription_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/subscription","commits_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/merges","archive_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/downloads","issues_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/deployments","created_at":"2014-09-11T22:06:52Z","updated_at":"2016-01-11T04:47:05Z","pushed_at":"2016-04-15T11:25:33Z","git_url":"git://github.com/mozilla/fxa-auth-db-mysql.git","ssh_url":"git@github.com:mozilla/fxa-auth-db-mysql.git","clone_url":"https://github.com/mozilla/fxa-auth-db-mysql.git","svn_url":"https://github.com/mozilla/fxa-auth-db-mysql","homepage":"","size":636,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":5,"forks":13,"open_issues":5,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/132"},"html":{"href":"https://github.com/mozilla/fxa-auth-db-mysql/pull/132"},"issue":{"href":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues/132"},"comments":{"href":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/issues/132/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/132/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/pulls/132/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/fxa-auth-db-mysql/statuses/cb3dbbfdffde6fca6e5a11dfbff8d9fe820755fe"}}}}