GitHub PullRequestReviewCommentEvent at 2014-08-12 14:50:29
Repository: Auth0.WindowsPhone
Actor: dschenkelman
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/comments/16117517","id":16117517,"diff_hunk":"@@ -149,48 +165,116 @@ public string CallbackUrl\n         }\r\n \r\n         /// <summary>\r\n-        /// Get a delegation token\r\n+        /// Renews the idToken (JWT)\r\n         /// </summary>\r\n-        /// <returns>Delegation token result.</returns>\r\n-        /// <param name=\"targetClientId\">Target client ID.</param>\r\n-        /// <param name=\"options\">Custom parameters.</param>\r\n-        public async Task<JObject> GetDelegationToken(string targetClientId, IDictionary<string, string> options = null)\r\n+        /// <returns>The refreshed token.</returns>\r\n+        /// <param name=\"refreshToken\">The refresh token</param>\r\n+        /// <param name=\"options\">Additional parameters.</param>\r\n+        public async Task<JObject> RefreshToken(\r\n+            string refreshToken = \"\", \r\n+            Dictionary<string, string> options = null)\r\n         {\r\n-            var id_token = string.Empty;\r\n-            options = options ?? new Dictionary<string, string>();\r\n+            var emptyToken = string.IsNullOrEmpty(refreshToken);\r\n+            if (emptyToken && this.CurrentUser != null && string.IsNullOrEmpty(this.CurrentUser.RefreshToken))\r\n+            {\r\n+                throw new InvalidOperationException(\r\n+                    \"The current user's refresh_token could not be retrieved and no refresh_token was provided as parameter\");\r\n+            }\r\n+\r\n+            return await this.GetDelegationToken(\r\n+                api: \"app\",\r\n+                refreshToken: emptyToken ? this.CurrentUser.RefreshToken : this.CurrentUser.RefreshToken,\r\n+                options: options);\r\n+        }\r\n+\r\n+        /// <summary>\r\n+        /// Verifies if the jwt for the current user has expired.\r\n+        /// </summary>\r\n+        /// <returns>true if the token has expired, false otherwise.</returns>\r\n+        /// <remarks>Must be logged in before invoking.</remarks>\r\n+        public bool HasTokenExpired()\r\n+        {\r\n+            if (string.IsNullOrEmpty(this.CurrentUser.IdToken))\r\n+            {\r\n+                throw new InvalidOperationException(\"You need to either login first.\");\r\n+            }\r\n+\r\n+            return TokenValidator.HasExpired(this.CurrentUser.IdToken);\r\n+        }\r\n \r\n-            // ensure id_token\r\n-            if (options.ContainsKey(\"id_token\"))\r\n+        /// <summary>\r\n+        /// Renews the idToken (JWT)\r\n+        /// </summary>\r\n+        /// <returns>The refreshed token.</returns>\r\n+        /// <remarks>The JWT must not have expired.</remarks>\r\n+        /// <param name=\"options\">Additional parameters.</param>\r\n+        public Task<JObject> RenewIdToken(Dictionary<string, string> options = null)\r","path":"Auth0Client/Auth0Client.cs","position":120,"original_position":120,"commit_id":"fb5b22f64f27546cb3daf99b84cb8574dd88aced","original_commit_id":"fb5b22f64f27546cb3daf99b84cb8574dd88aced","user":{"login":"dschenkelman","id":3376731,"avatar_url":"https://avatars.githubusercontent.com/u/3376731?v=2","gravatar_id":"a68cb0f927eafc449f4046ea3edc09a2","url":"https://api.github.com/users/dschenkelman","html_url":"https://github.com/dschenkelman","followers_url":"https://api.github.com/users/dschenkelman/followers","following_url":"https://api.github.com/users/dschenkelman/following{/other_user}","gists_url":"https://api.github.com/users/dschenkelman/gists{/gist_id}","starred_url":"https://api.github.com/users/dschenkelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dschenkelman/subscriptions","organizations_url":"https://api.github.com/users/dschenkelman/orgs","repos_url":"https://api.github.com/users/dschenkelman/repos","events_url":"https://api.github.com/users/dschenkelman/events{/privacy}","received_events_url":"https://api.github.com/users/dschenkelman/received_events","type":"User","site_admin":false},"body":"Does not apply for delegation scenarios (passing `api: \"app\"`). Talked in person..","created_at":"2014-08-12T14:50:29Z","updated_at":"2014-08-12T14:50:29Z","html_url":"https://github.com/auth0/Auth0.WindowsPhone/pull/9#discussion_r16117517","pull_request_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/comments/16117517"},"html":{"href":"https://github.com/auth0/Auth0.WindowsPhone/pull/9#discussion_r16117517"},"pull_request":{"href":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/9","id":19368608,"html_url":"https://github.com/auth0/Auth0.WindowsPhone/pull/9","diff_url":"https://github.com/auth0/Auth0.WindowsPhone/pull/9.diff","patch_url":"https://github.com/auth0/Auth0.WindowsPhone/pull/9.patch","issue_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues/9","number":9,"state":"open","title":"Updated API for delegation token","user":{"login":"dschenkelman","id":3376731,"avatar_url":"https://avatars.githubusercontent.com/u/3376731?v=2","gravatar_id":"a68cb0f927eafc449f4046ea3edc09a2","url":"https://api.github.com/users/dschenkelman","html_url":"https://github.com/dschenkelman","followers_url":"https://api.github.com/users/dschenkelman/followers","following_url":"https://api.github.com/users/dschenkelman/following{/other_user}","gists_url":"https://api.github.com/users/dschenkelman/gists{/gist_id}","starred_url":"https://api.github.com/users/dschenkelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dschenkelman/subscriptions","organizations_url":"https://api.github.com/users/dschenkelman/orgs","repos_url":"https://api.github.com/users/dschenkelman/repos","events_url":"https://api.github.com/users/dschenkelman/events{/privacy}","received_events_url":"https://api.github.com/users/dschenkelman/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-08-05T20:48:50Z","updated_at":"2014-08-12T14:50:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bce21a8a74ac01aec315fa70053f06165368cc8d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/9/commits","review_comments_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/9/comments","review_comment_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/comments/{number}","comments_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues/9/comments","statuses_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/statuses/fb5b22f64f27546cb3daf99b84cb8574dd88aced","head":{"label":"auth0:delegationApi","ref":"delegationApi","sha":"fb5b22f64f27546cb3daf99b84cb8574dd88aced","user":{"login":"auth0","id":2824157,"avatar_url":"https://avatars.githubusercontent.com/u/2824157?v=2","gravatar_id":"805765c256ff8617fcad483b5476faf2","url":"https://api.github.com/users/auth0","html_url":"https://github.com/auth0","followers_url":"https://api.github.com/users/auth0/followers","following_url":"https://api.github.com/users/auth0/following{/other_user}","gists_url":"https://api.github.com/users/auth0/gists{/gist_id}","starred_url":"https://api.github.com/users/auth0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auth0/subscriptions","organizations_url":"https://api.github.com/users/auth0/orgs","repos_url":"https://api.github.com/users/auth0/repos","events_url":"https://api.github.com/users/auth0/events{/privacy}","received_events_url":"https://api.github.com/users/auth0/received_events","type":"Organization","site_admin":false},"repo":{"id":12486352,"name":"Auth0.WindowsPhone","full_name":"auth0/Auth0.WindowsPhone","owner":{"login":"auth0","id":2824157,"avatar_url":"https://avatars.githubusercontent.com/u/2824157?v=2","gravatar_id":"805765c256ff8617fcad483b5476faf2","url":"https://api.github.com/users/auth0","html_url":"https://github.com/auth0","followers_url":"https://api.github.com/users/auth0/followers","following_url":"https://api.github.com/users/auth0/following{/other_user}","gists_url":"https://api.github.com/users/auth0/gists{/gist_id}","starred_url":"https://api.github.com/users/auth0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auth0/subscriptions","organizations_url":"https://api.github.com/users/auth0/orgs","repos_url":"https://api.github.com/users/auth0/repos","events_url":"https://api.github.com/users/auth0/events{/privacy}","received_events_url":"https://api.github.com/users/auth0/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/auth0/Auth0.WindowsPhone","description":"","fork":false,"url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone","forks_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/forks","keys_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/teams","hooks_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/hooks","issue_events_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues/events{/number}","events_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/events","assignees_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/assignees{/user}","branches_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/branches{/branch}","tags_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/tags","blobs_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/refs{/sha}","trees_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/statuses/{sha}","languages_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/languages","stargazers_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/stargazers","contributors_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/contributors","subscribers_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/subscribers","subscription_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/subscription","commits_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/commits{/sha}","git_commits_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/commits{/sha}","comments_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/comments{/number}","issue_comment_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues/comments/{number}","contents_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/contents/{+path}","compare_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/merges","archive_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/downloads","issues_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues{/number}","pulls_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls{/number}","milestones_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/milestones{/number}","notifications_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/labels{/name}","releases_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/releases{/id}","created_at":"2013-08-30T12:56:12Z","updated_at":"2014-08-06T06:02:44Z","pushed_at":"2014-08-11T15:19:34Z","git_url":"git://github.com/auth0/Auth0.WindowsPhone.git","ssh_url":"git@github.com:auth0/Auth0.WindowsPhone.git","clone_url":"https://github.com/auth0/Auth0.WindowsPhone.git","svn_url":"https://github.com/auth0/Auth0.WindowsPhone","homepage":null,"size":789,"stargazers_count":5,"watchers_count":5,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":5,"default_branch":"master"}},"base":{"label":"auth0:master","ref":"master","sha":"189c87097142422994fd1dce28794829cdc43155","user":{"login":"auth0","id":2824157,"avatar_url":"https://avatars.githubusercontent.com/u/2824157?v=2","gravatar_id":"805765c256ff8617fcad483b5476faf2","url":"https://api.github.com/users/auth0","html_url":"https://github.com/auth0","followers_url":"https://api.github.com/users/auth0/followers","following_url":"https://api.github.com/users/auth0/following{/other_user}","gists_url":"https://api.github.com/users/auth0/gists{/gist_id}","starred_url":"https://api.github.com/users/auth0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auth0/subscriptions","organizations_url":"https://api.github.com/users/auth0/orgs","repos_url":"https://api.github.com/users/auth0/repos","events_url":"https://api.github.com/users/auth0/events{/privacy}","received_events_url":"https://api.github.com/users/auth0/received_events","type":"Organization","site_admin":false},"repo":{"id":12486352,"name":"Auth0.WindowsPhone","full_name":"auth0/Auth0.WindowsPhone","owner":{"login":"auth0","id":2824157,"avatar_url":"https://avatars.githubusercontent.com/u/2824157?v=2","gravatar_id":"805765c256ff8617fcad483b5476faf2","url":"https://api.github.com/users/auth0","html_url":"https://github.com/auth0","followers_url":"https://api.github.com/users/auth0/followers","following_url":"https://api.github.com/users/auth0/following{/other_user}","gists_url":"https://api.github.com/users/auth0/gists{/gist_id}","starred_url":"https://api.github.com/users/auth0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auth0/subscriptions","organizations_url":"https://api.github.com/users/auth0/orgs","repos_url":"https://api.github.com/users/auth0/repos","events_url":"https://api.github.com/users/auth0/events{/privacy}","received_events_url":"https://api.github.com/users/auth0/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/auth0/Auth0.WindowsPhone","description":"","fork":false,"url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone","forks_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/forks","keys_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/teams","hooks_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/hooks","issue_events_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues/events{/number}","events_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/events","assignees_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/assignees{/user}","branches_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/branches{/branch}","tags_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/tags","blobs_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/refs{/sha}","trees_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/statuses/{sha}","languages_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/languages","stargazers_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/stargazers","contributors_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/contributors","subscribers_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/subscribers","subscription_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/subscription","commits_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/commits{/sha}","git_commits_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/git/commits{/sha}","comments_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/comments{/number}","issue_comment_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues/comments/{number}","contents_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/contents/{+path}","compare_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/merges","archive_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/downloads","issues_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues{/number}","pulls_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls{/number}","milestones_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/milestones{/number}","notifications_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/labels{/name}","releases_url":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/releases{/id}","created_at":"2013-08-30T12:56:12Z","updated_at":"2014-08-06T06:02:44Z","pushed_at":"2014-08-11T15:19:34Z","git_url":"git://github.com/auth0/Auth0.WindowsPhone.git","ssh_url":"git@github.com:auth0/Auth0.WindowsPhone.git","clone_url":"https://github.com/auth0/Auth0.WindowsPhone.git","svn_url":"https://github.com/auth0/Auth0.WindowsPhone","homepage":null,"size":789,"stargazers_count":5,"watchers_count":5,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/9"},"html":{"href":"https://github.com/auth0/Auth0.WindowsPhone/pull/9"},"issue":{"href":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues/9"},"comments":{"href":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/auth0/Auth0.WindowsPhone/statuses/fb5b22f64f27546cb3daf99b84cb8574dd88aced"}}}}