{"action":"opened","number":21,"pull_request":{"url":"https://api.github.com/repos/khwilo/ireporter-API/pulls/21","id":235778113,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1Nzc4MTEz","html_url":"https://github.com/khwilo/ireporter-API/pull/21","diff_url":"https://github.com/khwilo/ireporter-API/pull/21.diff","patch_url":"https://github.com/khwilo/ireporter-API/pull/21.patch","issue_url":"https://api.github.com/repos/khwilo/ireporter-API/issues/21","number":21,"state":"open","locked":false,"title":"#162377808 Allow authorized users to access endpoints","user":{"login":"khwilo","id":5740429,"node_id":"MDQ6VXNlcjU3NDA0Mjk=","avatar_url":"https://avatars1.githubusercontent.com/u/5740429?v=4","gravatar_id":"","url":"https://api.github.com/users/khwilo","html_url":"https://github.com/khwilo","followers_url":"https://api.github.com/users/khwilo/followers","following_url":"https://api.github.com/users/khwilo/following{/other_user}","gists_url":"https://api.github.com/users/khwilo/gists{/gist_id}","starred_url":"https://api.github.com/users/khwilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khwilo/subscriptions","organizations_url":"https://api.github.com/users/khwilo/orgs","repos_url":"https://api.github.com/users/khwilo/repos","events_url":"https://api.github.com/users/khwilo/events{/privacy}","received_events_url":"https://api.github.com/users/khwilo/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\nProtect the endpoint by allowing only authenticated users to access them\r\n\r\n#### Description of Task to be completed?\r\n- Implement JSON Web Tokens to create access token and refresh token on sign up and sign in.\r\n- Write tests for implementing JSON Web token authentication.\r\n\r\n#### How should this be manually tested?\r\nOn Postman test the endpoints:\r\n- `POST '/api/v1/red-flags'`\r\n- `GET '/api/v1/red-flags'`\r\n- `GET '/api/v1/red-flags/<red-flag-id>` \r\n- `DELETE '/api/v1/red-flags/<red-flag-id>`\r\n- `PUT '/api/v1/red-flags/<red-flag-id>/location'`\r\n- `PUT '/api/v1/red-flags/<red-flag-id>/comment'`\r\n\r\nwith the following headers:\r\n- *key*  -  **Content-Type** , *value* - **application/json**\r\n- *key*  -  **Authorization**, *value* - **Bearer <access_token>**\r\n\r\n**NB** - *The access token value is retrieved from the response message after loggin in*\r\n\r\nOn Postman test the endpoints:\r\n- `POST '/auth/register'`\r\n- `POST '/auth/login'`\r\n\r\nwith the following header: \r\n- *key*  - **Content-Type** , *value* - **application/json**\r\n\r\n\r\n#### What are the relevant pivotal tracker stories?\r\n#162377808","created_at":"2018-12-04T11:44:26Z","updated_at":"2018-12-04T11:44:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/khwilo/ireporter-API/pulls/21/commits","review_comments_url":"https://api.github.com/repos/khwilo/ireporter-API/pulls/21/comments","review_comment_url":"https://api.github.com/repos/khwilo/ireporter-API/pulls/comments{/number}","comments_url":"https://api.github.com/repos/khwilo/ireporter-API/issues/21/comments","statuses_url":"https://api.github.com/repos/khwilo/ireporter-API/statuses/58b2c2b31cc369ce976159d9f2085c4fb3918bc9","head":{"label":"khwilo:ft-protected-routes-162377808","ref":"ft-protected-routes-162377808","sha":"58b2c2b31cc369ce976159d9f2085c4fb3918bc9","user":{"login":"khwilo","id":5740429,"node_id":"MDQ6VXNlcjU3NDA0Mjk=","avatar_url":"https://avatars1.githubusercontent.com/u/5740429?v=4","gravatar_id":"","url":"https://api.github.com/users/khwilo","html_url":"https://github.com/khwilo","followers_url":"https://api.github.com/users/khwilo/followers","following_url":"https://api.github.com/users/khwilo/following{/other_user}","gists_url":"https://api.github.com/users/khwilo/gists{/gist_id}","starred_url":"https://api.github.com/users/khwilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khwilo/subscriptions","organizations_url":"https://api.github.com/users/khwilo/orgs","repos_url":"https://api.github.com/users/khwilo/repos","events_url":"https://api.github.com/users/khwilo/events{/privacy}","received_events_url":"https://api.github.com/users/khwilo/received_events","type":"User","site_admin":false},"repo":{"id":159764079,"node_id":"MDEwOlJlcG9zaXRvcnkxNTk3NjQwNzk=","name":"ireporter-API","full_name":"khwilo/ireporter-API","private":false,"owner":{"login":"khwilo","id":5740429,"node_id":"MDQ6VXNlcjU3NDA0Mjk=","avatar_url":"https://avatars1.githubusercontent.com/u/5740429?v=4","gravatar_id":"","url":"https://api.github.com/users/khwilo","html_url":"https://github.com/khwilo","followers_url":"https://api.github.com/users/khwilo/followers","following_url":"https://api.github.com/users/khwilo/following{/other_user}","gists_url":"https://api.github.com/users/khwilo/gists{/gist_id}","starred_url":"https://api.github.com/users/khwilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khwilo/subscriptions","organizations_url":"https://api.github.com/users/khwilo/orgs","repos_url":"https://api.github.com/users/khwilo/repos","events_url":"https://api.github.com/users/khwilo/events{/privacy}","received_events_url":"https://api.github.com/users/khwilo/received_events","type":"User","site_admin":false},"html_url":"https://github.com/khwilo/ireporter-API","description":"API endpoints for the iReporter web application","fork":false,"url":"https://api.github.com/repos/khwilo/ireporter-API","forks_url":"https://api.github.com/repos/khwilo/ireporter-API/forks","keys_url":"https://api.github.com/repos/khwilo/ireporter-API/keys{/key_id}","collaborators_url":"https://api.github.com/repos/khwilo/ireporter-API/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/khwilo/ireporter-API/teams","hooks_url":"https://api.github.com/repos/khwilo/ireporter-API/hooks","issue_events_url":"https://api.github.com/repos/khwilo/ireporter-API/issues/events{/number}","events_url":"https://api.github.com/repos/khwilo/ireporter-API/events","assignees_url":"https://api.github.com/repos/khwilo/ireporter-API/assignees{/user}","branches_url":"https://api.github.com/repos/khwilo/ireporter-API/branches{/branch}","tags_url":"https://api.github.com/repos/khwilo/ireporter-API/tags","blobs_url":"https://api.github.com/repos/khwilo/ireporter-API/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/khwilo/ireporter-API/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/khwilo/ireporter-API/git/refs{/sha}","trees_url":"https://api.github.com/repos/khwilo/ireporter-API/git/trees{/sha}","statuses_url":"https://api.github.com/repos/khwilo/ireporter-API/statuses/{sha}","languages_url":"https://api.github.com/repos/khwilo/ireporter-API/languages","stargazers_url":"https://api.github.com/repos/khwilo/ireporter-API/stargazers","contributors_url":"https://api.github.com/repos/khwilo/ireporter-API/contributors","subscribers_url":"https://api.github.com/repos/khwilo/ireporter-API/subscribers","subscription_url":"https://api.github.com/repos/khwilo/ireporter-API/subscription","commits_url":"https://api.github.com/repos/khwilo/ireporter-API/commits{/sha}","git_commits_url":"https://api.github.com/repos/khwilo/ireporter-API/git/commits{/sha}","comments_url":"https://api.github.com/repos/khwilo/ireporter-API/comments{/number}","issue_comment_url":"https://api.github.com/repos/khwilo/ireporter-API/issues/comments{/number}","contents_url":"https://api.github.com/repos/khwilo/ireporter-API/contents/{+path}","compare_url":"https://api.github.com/repos/khwilo/ireporter-API/compare/{base}...{head}","merges_url":"https://api.github.com/repos/khwilo/ireporter-API/merges","archive_url":"https://api.github.com/repos/khwilo/ireporter-API/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/khwilo/ireporter-API/downloads","issues_url":"https://api.github.com/repos/khwilo/ireporter-API/issues{/number}","pulls_url":"https://api.github.com/repos/khwilo/ireporter-API/pulls{/number}","milestones_url":"https://api.github.com/repos/khwilo/ireporter-API/milestones{/number}","notifications_url":"https://api.github.com/repos/khwilo/ireporter-API/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/khwilo/ireporter-API/labels{/name}","releases_url":"https://api.github.com/repos/khwilo/ireporter-API/releases{/id}","deployments_url":"https://api.github.com/repos/khwilo/ireporter-API/deployments","created_at":"2018-11-30T03:35:40Z","updated_at":"2018-12-03T10:18:56Z","pushed_at":"2018-12-04T11:31:55Z","git_url":"git://github.com/khwilo/ireporter-API.git","ssh_url":"git@github.com:khwilo/ireporter-API.git","clone_url":"https://github.com/khwilo/ireporter-API.git","svn_url":"https://github.com/khwilo/ireporter-API","homepage":null,"size":47,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":1,"default_branch":"develop"}},"base":{"label":"khwilo:develop","ref":"develop","sha":"4a9a538a9e1b2f572b386fb8244d67547e05362c","user":{"login":"khwilo","id":5740429,"node_id":"MDQ6VXNlcjU3NDA0Mjk=","avatar_url":"https://avatars1.githubusercontent.com/u/5740429?v=4","gravatar_id":"","url":"https://api.github.com/users/khwilo","html_url":"https://github.com/khwilo","followers_url":"https://api.github.com/users/khwilo/followers","following_url":"https://api.github.com/users/khwilo/following{/other_user}","gists_url":"https://api.github.com/users/khwilo/gists{/gist_id}","starred_url":"https://api.github.com/users/khwilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khwilo/subscriptions","organizations_url":"https://api.github.com/users/khwilo/orgs","repos_url":"https://api.github.com/users/khwilo/repos","events_url":"https://api.github.com/users/khwilo/events{/privacy}","received_events_url":"https://api.github.com/users/khwilo/received_events","type":"User","site_admin":false},"repo":{"id":159764079,"node_id":"MDEwOlJlcG9zaXRvcnkxNTk3NjQwNzk=","name":"ireporter-API","full_name":"khwilo/ireporter-API","private":false,"owner":{"login":"khwilo","id":5740429,"node_id":"MDQ6VXNlcjU3NDA0Mjk=","avatar_url":"https://avatars1.githubusercontent.com/u/5740429?v=4","gravatar_id":"","url":"https://api.github.com/users/khwilo","html_url":"https://github.com/khwilo","followers_url":"https://api.github.com/users/khwilo/followers","following_url":"https://api.github.com/users/khwilo/following{/other_user}","gists_url":"https://api.github.com/users/khwilo/gists{/gist_id}","starred_url":"https://api.github.com/users/khwilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khwilo/subscriptions","organizations_url":"https://api.github.com/users/khwilo/orgs","repos_url":"https://api.github.com/users/khwilo/repos","events_url":"https://api.github.com/users/khwilo/events{/privacy}","received_events_url":"https://api.github.com/users/khwilo/received_events","type":"User","site_admin":false},"html_url":"https://github.com/khwilo/ireporter-API","description":"API endpoints for the iReporter web application","fork":false,"url":"https://api.github.com/repos/khwilo/ireporter-API","forks_url":"https://api.github.com/repos/khwilo/ireporter-API/forks","keys_url":"https://api.github.com/repos/khwilo/ireporter-API/keys{/key_id}","collaborators_url":"https://api.github.com/repos/khwilo/ireporter-API/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/khwilo/ireporter-API/teams","hooks_url":"https://api.github.com/repos/khwilo/ireporter-API/hooks","issue_events_url":"https://api.github.com/repos/khwilo/ireporter-API/issues/events{/number}","events_url":"https://api.github.com/repos/khwilo/ireporter-API/events","assignees_url":"https://api.github.com/repos/khwilo/ireporter-API/assignees{/user}","branches_url":"https://api.github.com/repos/khwilo/ireporter-API/branches{/branch}","tags_url":"https://api.github.com/repos/khwilo/ireporter-API/tags","blobs_url":"https://api.github.com/repos/khwilo/ireporter-API/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/khwilo/ireporter-API/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/khwilo/ireporter-API/git/refs{/sha}","trees_url":"https://api.github.com/repos/khwilo/ireporter-API/git/trees{/sha}","statuses_url":"https://api.github.com/repos/khwilo/ireporter-API/statuses/{sha}","languages_url":"https://api.github.com/repos/khwilo/ireporter-API/languages","stargazers_url":"https://api.github.com/repos/khwilo/ireporter-API/stargazers","contributors_url":"https://api.github.com/repos/khwilo/ireporter-API/contributors","subscribers_url":"https://api.github.com/repos/khwilo/ireporter-API/subscribers","subscription_url":"https://api.github.com/repos/khwilo/ireporter-API/subscription","commits_url":"https://api.github.com/repos/khwilo/ireporter-API/commits{/sha}","git_commits_url":"https://api.github.com/repos/khwilo/ireporter-API/git/commits{/sha}","comments_url":"https://api.github.com/repos/khwilo/ireporter-API/comments{/number}","issue_comment_url":"https://api.github.com/repos/khwilo/ireporter-API/issues/comments{/number}","contents_url":"https://api.github.com/repos/khwilo/ireporter-API/contents/{+path}","compare_url":"https://api.github.com/repos/khwilo/ireporter-API/compare/{base}...{head}","merges_url":"https://api.github.com/repos/khwilo/ireporter-API/merges","archive_url":"https://api.github.com/repos/khwilo/ireporter-API/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/khwilo/ireporter-API/downloads","issues_url":"https://api.github.com/repos/khwilo/ireporter-API/issues{/number}","pulls_url":"https://api.github.com/repos/khwilo/ireporter-API/pulls{/number}","milestones_url":"https://api.github.com/repos/khwilo/ireporter-API/milestones{/number}","notifications_url":"https://api.github.com/repos/khwilo/ireporter-API/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/khwilo/ireporter-API/labels{/name}","releases_url":"https://api.github.com/repos/khwilo/ireporter-API/releases{/id}","deployments_url":"https://api.github.com/repos/khwilo/ireporter-API/deployments","created_at":"2018-11-30T03:35:40Z","updated_at":"2018-12-03T10:18:56Z","pushed_at":"2018-12-04T11:31:55Z","git_url":"git://github.com/khwilo/ireporter-API.git","ssh_url":"git@github.com:khwilo/ireporter-API.git","clone_url":"https://github.com/khwilo/ireporter-API.git","svn_url":"https://github.com/khwilo/ireporter-API","homepage":null,"size":47,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/khwilo/ireporter-API/pulls/21"},"html":{"href":"https://github.com/khwilo/ireporter-API/pull/21"},"issue":{"href":"https://api.github.com/repos/khwilo/ireporter-API/issues/21"},"comments":{"href":"https://api.github.com/repos/khwilo/ireporter-API/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/khwilo/ireporter-API/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/khwilo/ireporter-API/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/khwilo/ireporter-API/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/khwilo/ireporter-API/statuses/58b2c2b31cc369ce976159d9f2085c4fb3918bc9"}},"author_association":"OWNER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":29,"additions":420,"deletions":78,"changed_files":7}}
{"actor":{"display_login":"khwilo"}}