{"action":"closed","number":638,"pull_request":{"url":"https://api.github.com/repos/akveo/nebular/pulls/638","id":208500984,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4NTAwOTg0","html_url":"https://github.com/akveo/nebular/pull/638","diff_url":"https://github.com/akveo/nebular/pull/638.diff","patch_url":"https://github.com/akveo/nebular/pull/638.patch","issue_url":"https://api.github.com/repos/akveo/nebular/issues/638","number":638,"state":"closed","locked":false,"title":"Feat/Auth : refreshToken requests fully managed by NbAuthService & NbAuthJWTInterceptor","user":{"login":"alain-charles","id":40032406,"node_id":"MDQ6VXNlcjQwMDMyNDA2","avatar_url":"https://avatars0.githubusercontent.com/u/40032406?v=4","gravatar_id":"","url":"https://api.github.com/users/alain-charles","html_url":"https://github.com/alain-charles","followers_url":"https://api.github.com/users/alain-charles/followers","following_url":"https://api.github.com/users/alain-charles/following{/other_user}","gists_url":"https://api.github.com/users/alain-charles/gists{/gist_id}","starred_url":"https://api.github.com/users/alain-charles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alain-charles/subscriptions","organizations_url":"https://api.github.com/users/alain-charles/orgs","repos_url":"https://api.github.com/users/alain-charles/repos","events_url":"https://api.github.com/users/alain-charles/events{/privacy}","received_events_url":"https://api.github.com/users/alain-charles/received_events","type":"User","site_admin":false},"body":"### RefreshToken requests fully managed by NbAuthService & NbAuthJWTInterceptor\r\n\r\nThis pull requests intends to provide the necessary code so that refreshtoken requests are automatically sent to the backend when the local stored accesstoken has expired.\r\nThis allows the user not to type his login/password as long as his refresh-token is valid.\r\nThe refreshtoken requests are sent transparently.\r\n\r\n### Run it in the playground\r\nYou can easily test the code by calling the url http://localhost:4200/#/auth/api-calls.component\r\nThen the AuthGuard service redirects you to the login page.\r\n\r\nThe strategy used to log in is Oauth2 with password grant-type, so you can use example@akveo.com.\r\n\r\nYou are then logged with an access token whose ttl is 60 seconds and a refresh token whose ttl is 120 seconds.\r\nThese values can be modified in the configuration of the backend (config.js).\r\n\r\n<img width=\"775\" alt=\"capture d ecran 2018-08-15 a 10 04 43\" src=\"https://user-images.githubusercontent.com/40032406/44138143-49889734-a073-11e8-81d7-807a8efac6b8.png\">\r\n\r\n\r\n### Call of the secured api\r\nOnce logged, go immediately to http://localhost:4200/#/auth/api-calls.component and click the call API button.\r\n\r\nThe XHR request is send with the authorization header containing Bearer + the access-token.\r\nYou can see that Alain's got good wines in his cellar.\r\n\r\n<img width=\"483\" alt=\"capture d ecran 2018-08-15 a 10 05 40\" src=\"https://user-images.githubusercontent.com/40032406/44138236-8db59bb4-a073-11e8-8409-4f3304f6f120.png\">\r\n\r\n### Automatic refresh-token request\r\nWait a minute, and click once again on the call-api button.\r\n\r\nObserve the network logs of you browser : the acces-token was expired, so the framework sent automatically a refresh request to the backend\r\n<img width=\"821\" alt=\"capture d ecran 2018-08-15 a 10 06 25\" src=\"https://user-images.githubusercontent.com/40032406/44138437-3b6325d8-a074-11e8-9d30-7fedd2f0023f.png\">\r\nwith the next content :\r\n<img width=\"771\" alt=\"capture d ecran 2018-08-15 a 10 07 02\" src=\"https://user-images.githubusercontent.com/40032406/44138354-f08647e8-a073-11e8-9dac-b45b81c4111c.png\">\r\nand it got a new access-token:\r\n<img width=\"764\" alt=\"capture d ecran 2018-08-15 a 10 07 10\" src=\"https://user-images.githubusercontent.com/40032406/44138368-fd5e1784-a073-11e8-83c0-627c7ebad138.png\">\r\n\r\nthen it called with success then api.\r\n\r\n\r\n### Automatic redirect to login\r\nIf you wait once a minute, and if you click the call-api button, the framework sends a new refreshToken request\r\n<img width=\"824\" alt=\"capture d ecran 2018-08-15 a 10 07 41\" src=\"https://user-images.githubusercontent.com/40032406/44138666-f0404ecc-a074-11e8-9b3b-9cd8ab4bde76.png\">\r\n\r\n but you are redirected to the login page, because refresh-token itself expired.\r\n<img width=\"295\" alt=\"capture d ecran 2018-08-15 a 10 07 56\" src=\"https://user-images.githubusercontent.com/40032406/44138680-fb60716a-a074-11e8-8afd-e45b14ac2647.png\">\r\n\r\n\r\nHope you will like this work.\r\n\r\n\r\n\r\n\r\n","created_at":"2018-08-15T08:23:49Z","updated_at":"2018-08-22T15:09:28Z","closed_at":"2018-08-22T15:09:28Z","merged_at":null,"merge_commit_sha":"bdcccd4d2dece1825c4dba2840b4d6bdbcda70d9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/akveo/nebular/pulls/638/commits","review_comments_url":"https://api.github.com/repos/akveo/nebular/pulls/638/comments","review_comment_url":"https://api.github.com/repos/akveo/nebular/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akveo/nebular/issues/638/comments","statuses_url":"https://api.github.com/repos/akveo/nebular/statuses/c0bf6a336eab1371aae310f01d3c088272dd3522","head":{"label":"alain-charles:feat/auth-automaticRefreshToken","ref":"feat/auth-automaticRefreshToken","sha":"c0bf6a336eab1371aae310f01d3c088272dd3522","user":{"login":"alain-charles","id":40032406,"node_id":"MDQ6VXNlcjQwMDMyNDA2","avatar_url":"https://avatars0.githubusercontent.com/u/40032406?v=4","gravatar_id":"","url":"https://api.github.com/users/alain-charles","html_url":"https://github.com/alain-charles","followers_url":"https://api.github.com/users/alain-charles/followers","following_url":"https://api.github.com/users/alain-charles/following{/other_user}","gists_url":"https://api.github.com/users/alain-charles/gists{/gist_id}","starred_url":"https://api.github.com/users/alain-charles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alain-charles/subscriptions","organizations_url":"https://api.github.com/users/alain-charles/orgs","repos_url":"https://api.github.com/users/alain-charles/repos","events_url":"https://api.github.com/users/alain-charles/events{/privacy}","received_events_url":"https://api.github.com/users/alain-charles/received_events","type":"User","site_admin":false},"repo":{"id":138839483,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg4Mzk0ODM=","name":"nebular","full_name":"alain-charles/nebular","owner":{"login":"alain-charles","id":40032406,"node_id":"MDQ6VXNlcjQwMDMyNDA2","avatar_url":"https://avatars0.githubusercontent.com/u/40032406?v=4","gravatar_id":"","url":"https://api.github.com/users/alain-charles","html_url":"https://github.com/alain-charles","followers_url":"https://api.github.com/users/alain-charles/followers","following_url":"https://api.github.com/users/alain-charles/following{/other_user}","gists_url":"https://api.github.com/users/alain-charles/gists{/gist_id}","starred_url":"https://api.github.com/users/alain-charles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alain-charles/subscriptions","organizations_url":"https://api.github.com/users/alain-charles/orgs","repos_url":"https://api.github.com/users/alain-charles/repos","events_url":"https://api.github.com/users/alain-charles/events{/privacy}","received_events_url":"https://api.github.com/users/alain-charles/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alain-charles/nebular","description":"Nebular is a set of essential modules for your next Angular 6 application.","fork":true,"url":"https://api.github.com/repos/alain-charles/nebular","forks_url":"https://api.github.com/repos/alain-charles/nebular/forks","keys_url":"https://api.github.com/repos/alain-charles/nebular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alain-charles/nebular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alain-charles/nebular/teams","hooks_url":"https://api.github.com/repos/alain-charles/nebular/hooks","issue_events_url":"https://api.github.com/repos/alain-charles/nebular/issues/events{/number}","events_url":"https://api.github.com/repos/alain-charles/nebular/events","assignees_url":"https://api.github.com/repos/alain-charles/nebular/assignees{/user}","branches_url":"https://api.github.com/repos/alain-charles/nebular/branches{/branch}","tags_url":"https://api.github.com/repos/alain-charles/nebular/tags","blobs_url":"https://api.github.com/repos/alain-charles/nebular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alain-charles/nebular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alain-charles/nebular/git/refs{/sha}","trees_url":"https://api.github.com/repos/alain-charles/nebular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alain-charles/nebular/statuses/{sha}","languages_url":"https://api.github.com/repos/alain-charles/nebular/languages","stargazers_url":"https://api.github.com/repos/alain-charles/nebular/stargazers","contributors_url":"https://api.github.com/repos/alain-charles/nebular/contributors","subscribers_url":"https://api.github.com/repos/alain-charles/nebular/subscribers","subscription_url":"https://api.github.com/repos/alain-charles/nebular/subscription","commits_url":"https://api.github.com/repos/alain-charles/nebular/commits{/sha}","git_commits_url":"https://api.github.com/repos/alain-charles/nebular/git/commits{/sha}","comments_url":"https://api.github.com/repos/alain-charles/nebular/comments{/number}","issue_comment_url":"https://api.github.com/repos/alain-charles/nebular/issues/comments{/number}","contents_url":"https://api.github.com/repos/alain-charles/nebular/contents/{+path}","compare_url":"https://api.github.com/repos/alain-charles/nebular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alain-charles/nebular/merges","archive_url":"https://api.github.com/repos/alain-charles/nebular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alain-charles/nebular/downloads","issues_url":"https://api.github.com/repos/alain-charles/nebular/issues{/number}","pulls_url":"https://api.github.com/repos/alain-charles/nebular/pulls{/number}","milestones_url":"https://api.github.com/repos/alain-charles/nebular/milestones{/number}","notifications_url":"https://api.github.com/repos/alain-charles/nebular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alain-charles/nebular/labels{/name}","releases_url":"https://api.github.com/repos/alain-charles/nebular/releases{/id}","deployments_url":"https://api.github.com/repos/alain-charles/nebular/deployments","created_at":"2018-06-27T06:32:11Z","updated_at":"2018-08-21T17:39:57Z","pushed_at":"2018-08-21T17:39:55Z","git_url":"git://github.com/alain-charles/nebular.git","ssh_url":"git@github.com:alain-charles/nebular.git","clone_url":"https://github.com/alain-charles/nebular.git","svn_url":"https://github.com/alain-charles/nebular","homepage":"https://akveo.github.io/nebular","size":55732,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akveo:master","ref":"master","sha":"ff8e9b61b721af7678d0a5b0e794f1a0560190a8","user":{"login":"akveo","id":11921694,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExOTIxNjk0","avatar_url":"https://avatars3.githubusercontent.com/u/11921694?v=4","gravatar_id":"","url":"https://api.github.com/users/akveo","html_url":"https://github.com/akveo","followers_url":"https://api.github.com/users/akveo/followers","following_url":"https://api.github.com/users/akveo/following{/other_user}","gists_url":"https://api.github.com/users/akveo/gists{/gist_id}","starred_url":"https://api.github.com/users/akveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akveo/subscriptions","organizations_url":"https://api.github.com/users/akveo/orgs","repos_url":"https://api.github.com/users/akveo/repos","events_url":"https://api.github.com/users/akveo/events{/privacy}","received_events_url":"https://api.github.com/users/akveo/received_events","type":"Organization","site_admin":false},"repo":{"id":104188467,"node_id":"MDEwOlJlcG9zaXRvcnkxMDQxODg0Njc=","name":"nebular","full_name":"akveo/nebular","owner":{"login":"akveo","id":11921694,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExOTIxNjk0","avatar_url":"https://avatars3.githubusercontent.com/u/11921694?v=4","gravatar_id":"","url":"https://api.github.com/users/akveo","html_url":"https://github.com/akveo","followers_url":"https://api.github.com/users/akveo/followers","following_url":"https://api.github.com/users/akveo/following{/other_user}","gists_url":"https://api.github.com/users/akveo/gists{/gist_id}","starred_url":"https://api.github.com/users/akveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akveo/subscriptions","organizations_url":"https://api.github.com/users/akveo/orgs","repos_url":"https://api.github.com/users/akveo/repos","events_url":"https://api.github.com/users/akveo/events{/privacy}","received_events_url":"https://api.github.com/users/akveo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akveo/nebular","description":"Nebular is a set of essential modules for your next Angular 6 application.","fork":false,"url":"https://api.github.com/repos/akveo/nebular","forks_url":"https://api.github.com/repos/akveo/nebular/forks","keys_url":"https://api.github.com/repos/akveo/nebular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akveo/nebular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akveo/nebular/teams","hooks_url":"https://api.github.com/repos/akveo/nebular/hooks","issue_events_url":"https://api.github.com/repos/akveo/nebular/issues/events{/number}","events_url":"https://api.github.com/repos/akveo/nebular/events","assignees_url":"https://api.github.com/repos/akveo/nebular/assignees{/user}","branches_url":"https://api.github.com/repos/akveo/nebular/branches{/branch}","tags_url":"https://api.github.com/repos/akveo/nebular/tags","blobs_url":"https://api.github.com/repos/akveo/nebular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akveo/nebular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akveo/nebular/git/refs{/sha}","trees_url":"https://api.github.com/repos/akveo/nebular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akveo/nebular/statuses/{sha}","languages_url":"https://api.github.com/repos/akveo/nebular/languages","stargazers_url":"https://api.github.com/repos/akveo/nebular/stargazers","contributors_url":"https://api.github.com/repos/akveo/nebular/contributors","subscribers_url":"https://api.github.com/repos/akveo/nebular/subscribers","subscription_url":"https://api.github.com/repos/akveo/nebular/subscription","commits_url":"https://api.github.com/repos/akveo/nebular/commits{/sha}","git_commits_url":"https://api.github.com/repos/akveo/nebular/git/commits{/sha}","comments_url":"https://api.github.com/repos/akveo/nebular/comments{/number}","issue_comment_url":"https://api.github.com/repos/akveo/nebular/issues/comments{/number}","contents_url":"https://api.github.com/repos/akveo/nebular/contents/{+path}","compare_url":"https://api.github.com/repos/akveo/nebular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akveo/nebular/merges","archive_url":"https://api.github.com/repos/akveo/nebular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akveo/nebular/downloads","issues_url":"https://api.github.com/repos/akveo/nebular/issues{/number}","pulls_url":"https://api.github.com/repos/akveo/nebular/pulls{/number}","milestones_url":"https://api.github.com/repos/akveo/nebular/milestones{/number}","notifications_url":"https://api.github.com/repos/akveo/nebular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akveo/nebular/labels{/name}","releases_url":"https://api.github.com/repos/akveo/nebular/releases{/id}","deployments_url":"https://api.github.com/repos/akveo/nebular/deployments","created_at":"2017-09-20T08:33:06Z","updated_at":"2018-08-22T14:22:34Z","pushed_at":"2018-08-22T15:08:59Z","git_url":"git://github.com/akveo/nebular.git","ssh_url":"git@github.com:akveo/nebular.git","clone_url":"https://github.com/akveo/nebular.git","svn_url":"https://github.com/akveo/nebular","homepage":"https://akveo.github.io/nebular","size":56045,"stargazers_count":1968,"watchers_count":1968,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":473,"mirror_url":null,"archived":false,"open_issues_count":126,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":473,"open_issues":126,"watchers":1968,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akveo/nebular/pulls/638"},"html":{"href":"https://github.com/akveo/nebular/pull/638"},"issue":{"href":"https://api.github.com/repos/akveo/nebular/issues/638"},"comments":{"href":"https://api.github.com/repos/akveo/nebular/issues/638/comments"},"review_comments":{"href":"https://api.github.com/repos/akveo/nebular/pulls/638/comments"},"review_comment":{"href":"https://api.github.com/repos/akveo/nebular/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akveo/nebular/pulls/638/commits"},"statuses":{"href":"https://api.github.com/repos/akveo/nebular/statuses/c0bf6a336eab1371aae310f01d3c088272dd3522"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":false,"rebaseable":false,"mergeable_state":"dirty","merged_by":null,"comments":17,"review_comments":9,"maintainer_can_modify":false,"commits":59,"additions":496,"deletions":63,"changed_files":18}}
{"actor":{"display_login":"nnixaa"}}