{"action":"created","comment":{"url":"https://api.github.com/repos/auth0/wp-auth0/pulls/comments/173962277","pull_request_review_id":103237561,"id":173962277,"diff_hunk":"@@ -163,136 +170,124 @@ public function init_auth0() {\n       } else {\n         $this->redirect_login();\n       }\n-    } catch (WP_Auth0_LoginFlowValidationException $e) {\n+    } catch ( WP_Auth0_LoginFlowValidationException $e ) {\n \n+      // Errors during the OAuth login flow\n       $this->die_on_login( $e->getMessage(), $e->getCode() );\n \n-    } catch (WP_Auth0_BeforeLoginException $e) {\n+    } catch ( WP_Auth0_BeforeLoginException $e ) {\n \n+      // Errors during the WordPress login flow\n       $this->die_on_login( $e->getMessage(), $e->getCode(), FALSE );\n-\n-    } catch (Exception $e) {\n-\n     }\n-\n   }\n \n+  /**\n+   * Main login flow, Authorization Code Grant\n+   *\n+   * @throws WP_Auth0_BeforeLoginException\n+   * @throws WP_Auth0_LoginFlowValidationException\n+   *\n+   * @see https://auth0.com/docs/api-auth/tutorials/authorization-code-grant\n+   */\n   public function redirect_login() {\n-    global $wp_query;\n-\n-    if ( $this->query_vars( 'auth0' ) === null ) {\n-      return;\n-    }\n-\n-    if ( $this->query_vars( 'error_description' ) !== null && $this->query_vars( 'error_description' ) !== '' ) {\n-      throw new WP_Auth0_LoginFlowValidationException( sanitize_text_field( $this->query_vars( 'error_description' ) ) );\n-    }\n-\n-    if ( $this->query_vars( 'error' ) !== null && trim( $this->query_vars( 'error' ) ) !== '' ) {\n-      throw new WP_Auth0_LoginFlowValidationException( sanitize_text_field( $this->query_vars( 'error' ) ) );\n-    }\n-\n-    $code = $this->query_vars( 'code' );\n-    $state_decoded = $this->get_state();\n \n     $domain = $this->a0_options->get( 'domain' );\n \n     $client_id = $this->a0_options->get( 'client_id' );\n     $client_secret = $this->a0_options->get( 'client_secret' );\n \n-    if ( empty( $client_id ) ) {","path":"lib/WP_Auth0_LoginManager.php","position":75,"original_position":75,"commit_id":"46e20ecf53029b81a0ee82dd664123afa5d6bca4","original_commit_id":"46e20ecf53029b81a0ee82dd664123afa5d6bca4","user":{"login":"joshcanhelp","id":855223,"avatar_url":"https://avatars2.githubusercontent.com/u/855223?v=4","gravatar_id":"","url":"https://api.github.com/users/joshcanhelp","html_url":"https://github.com/joshcanhelp","followers_url":"https://api.github.com/users/joshcanhelp/followers","following_url":"https://api.github.com/users/joshcanhelp/following{/other_user}","gists_url":"https://api.github.com/users/joshcanhelp/gists{/gist_id}","starred_url":"https://api.github.com/users/joshcanhelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshcanhelp/subscriptions","organizations_url":"https://api.github.com/users/joshcanhelp/orgs","repos_url":"https://api.github.com/users/joshcanhelp/repos","events_url":"https://api.github.com/users/joshcanhelp/events{/privacy}","received_events_url":"https://api.github.com/users/joshcanhelp/received_events","type":"User","site_admin":false},"body":"Handled earlier in `init_auth0()` by `WP_Auth0::ready()`","created_at":"2018-03-12T22:05:56Z","updated_at":"2018-03-12T22:05:56Z","html_url":"https://github.com/auth0/wp-auth0/pull/409#discussion_r173962277","pull_request_url":"https://api.github.com/repos/auth0/wp-auth0/pulls/409","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/auth0/wp-auth0/pulls/comments/173962277"},"html":{"href":"https://github.com/auth0/wp-auth0/pull/409#discussion_r173962277"},"pull_request":{"href":"https://api.github.com/repos/auth0/wp-auth0/pulls/409"}}},"pull_request":{"url":"https://api.github.com/repos/auth0/wp-auth0/pulls/409","id":174133360,"html_url":"https://github.com/auth0/wp-auth0/pull/409","diff_url":"https://github.com/auth0/wp-auth0/pull/409.diff","patch_url":"https://github.com/auth0/wp-auth0/pull/409.patch","issue_url":"https://api.github.com/repos/auth0/wp-auth0/issues/409","number":409,"state":"open","locked":false,"title":"[WIP] Fix login process error reporting","user":{"login":"joshcanhelp","id":855223,"avatar_url":"https://avatars2.githubusercontent.com/u/855223?v=4","gravatar_id":"","url":"https://api.github.com/users/joshcanhelp","html_url":"https://github.com/joshcanhelp","followers_url":"https://api.github.com/users/joshcanhelp/followers","following_url":"https://api.github.com/users/joshcanhelp/following{/other_user}","gists_url":"https://api.github.com/users/joshcanhelp/gists{/gist_id}","starred_url":"https://api.github.com/users/joshcanhelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshcanhelp/subscriptions","organizations_url":"https://api.github.com/users/joshcanhelp/orgs","repos_url":"https://api.github.com/users/joshcanhelp/repos","events_url":"https://api.github.com/users/joshcanhelp/events{/privacy}","received_events_url":"https://api.github.com/users/joshcanhelp/received_events","type":"User","site_admin":false},"body":"**Need to rebase against `dev` once the base above has been merged**\r\n\r\nWP_Auth0_LoginManager was not processing errors well, was poorly\r\ndocumented, and might have been improperly exposing error messages.\r\nIncoming URL param errors from Auth0 and configuration issues are caught\r\nearlier in the login process. Error message are not exposed to the\r\nuser; instead they are logged for an admin. Thrown errors are\r\nstandarized and listed in docblocks.\r\n\r\nFixes #305","created_at":"2018-03-09T23:29:13Z","updated_at":"2018-03-12T22:05:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d42a773403b2fa05e6d89a4463db96effc5f4192","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":136299661,"url":"https://api.github.com/repos/auth0/wp-auth0/labels/WIP","name":"WIP","color":"bfe5bf","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/auth0/wp-auth0/pulls/409/commits","review_comments_url":"https://api.github.com/repos/auth0/wp-auth0/pulls/409/comments","review_comment_url":"https://api.github.com/repos/auth0/wp-auth0/pulls/comments{/number}","comments_url":"https://api.github.com/repos/auth0/wp-auth0/issues/409/comments","statuses_url":"https://api.github.com/repos/auth0/wp-auth0/statuses/46e20ecf53029b81a0ee82dd664123afa5d6bca4","head":{"label":"auth0:fixed-login-error-handling","ref":"fixed-login-error-handling","sha":"46e20ecf53029b81a0ee82dd664123afa5d6bca4","user":{"login":"auth0","id":2824157,"avatar_url":"https://avatars1.githubusercontent.com/u/2824157?v=4","gravatar_id":"","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":16893279,"name":"wp-auth0","full_name":"auth0/wp-auth0","owner":{"login":"auth0","id":2824157,"avatar_url":"https://avatars1.githubusercontent.com/u/2824157?v=4","gravatar_id":"","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/wp-auth0","description":"Wordpress Plugin for Auth0","fork":false,"url":"https://api.github.com/repos/auth0/wp-auth0","forks_url":"https://api.github.com/repos/auth0/wp-auth0/forks","keys_url":"https://api.github.com/repos/auth0/wp-auth0/keys{/key_id}","collaborators_url":"https://api.github.com/repos/auth0/wp-auth0/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/auth0/wp-auth0/teams","hooks_url":"https://api.github.com/repos/auth0/wp-auth0/hooks","issue_events_url":"https://api.github.com/repos/auth0/wp-auth0/issues/events{/number}","events_url":"https://api.github.com/repos/auth0/wp-auth0/events","assignees_url":"https://api.github.com/repos/auth0/wp-auth0/assignees{/user}","branches_url":"https://api.github.com/repos/auth0/wp-auth0/branches{/branch}","tags_url":"https://api.github.com/repos/auth0/wp-auth0/tags","blobs_url":"https://api.github.com/repos/auth0/wp-auth0/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/auth0/wp-auth0/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/auth0/wp-auth0/git/refs{/sha}","trees_url":"https://api.github.com/repos/auth0/wp-auth0/git/trees{/sha}","statuses_url":"https://api.github.com/repos/auth0/wp-auth0/statuses/{sha}","languages_url":"https://api.github.com/repos/auth0/wp-auth0/languages","stargazers_url":"https://api.github.com/repos/auth0/wp-auth0/stargazers","contributors_url":"https://api.github.com/repos/auth0/wp-auth0/contributors","subscribers_url":"https://api.github.com/repos/auth0/wp-auth0/subscribers","subscription_url":"https://api.github.com/repos/auth0/wp-auth0/subscription","commits_url":"https://api.github.com/repos/auth0/wp-auth0/commits{/sha}","git_commits_url":"https://api.github.com/repos/auth0/wp-auth0/git/commits{/sha}","comments_url":"https://api.github.com/repos/auth0/wp-auth0/comments{/number}","issue_comment_url":"https://api.github.com/repos/auth0/wp-auth0/issues/comments{/number}","contents_url":"https://api.github.com/repos/auth0/wp-auth0/contents/{+path}","compare_url":"https://api.github.com/repos/auth0/wp-auth0/compare/{base}...{head}","merges_url":"https://api.github.com/repos/auth0/wp-auth0/merges","archive_url":"https://api.github.com/repos/auth0/wp-auth0/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/auth0/wp-auth0/downloads","issues_url":"https://api.github.com/repos/auth0/wp-auth0/issues{/number}","pulls_url":"https://api.github.com/repos/auth0/wp-auth0/pulls{/number}","milestones_url":"https://api.github.com/repos/auth0/wp-auth0/milestones{/number}","notifications_url":"https://api.github.com/repos/auth0/wp-auth0/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/auth0/wp-auth0/labels{/name}","releases_url":"https://api.github.com/repos/auth0/wp-auth0/releases{/id}","deployments_url":"https://api.github.com/repos/auth0/wp-auth0/deployments","created_at":"2014-02-16T20:20:08Z","updated_at":"2018-03-12T20:27:57Z","pushed_at":"2018-03-12T22:02:38Z","git_url":"git://github.com/auth0/wp-auth0.git","ssh_url":"git@github.com:auth0/wp-auth0.git","clone_url":"https://github.com/auth0/wp-auth0.git","svn_url":"https://github.com/auth0/wp-auth0","homepage":"https://auth0.com/wordpress","size":7989,"stargazers_count":65,"watchers_count":65,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":51,"mirror_url":null,"archived":false,"open_issues_count":37,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":51,"open_issues":37,"watchers":65,"default_branch":"master"}},"base":{"label":"auth0:dev","ref":"dev","sha":"02c6bba2d4ef811d7c3a44e59935339ddce64931","user":{"login":"auth0","id":2824157,"avatar_url":"https://avatars1.githubusercontent.com/u/2824157?v=4","gravatar_id":"","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":16893279,"name":"wp-auth0","full_name":"auth0/wp-auth0","owner":{"login":"auth0","id":2824157,"avatar_url":"https://avatars1.githubusercontent.com/u/2824157?v=4","gravatar_id":"","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/wp-auth0","description":"Wordpress Plugin for Auth0","fork":false,"url":"https://api.github.com/repos/auth0/wp-auth0","forks_url":"https://api.github.com/repos/auth0/wp-auth0/forks","keys_url":"https://api.github.com/repos/auth0/wp-auth0/keys{/key_id}","collaborators_url":"https://api.github.com/repos/auth0/wp-auth0/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/auth0/wp-auth0/teams","hooks_url":"https://api.github.com/repos/auth0/wp-auth0/hooks","issue_events_url":"https://api.github.com/repos/auth0/wp-auth0/issues/events{/number}","events_url":"https://api.github.com/repos/auth0/wp-auth0/events","assignees_url":"https://api.github.com/repos/auth0/wp-auth0/assignees{/user}","branches_url":"https://api.github.com/repos/auth0/wp-auth0/branches{/branch}","tags_url":"https://api.github.com/repos/auth0/wp-auth0/tags","blobs_url":"https://api.github.com/repos/auth0/wp-auth0/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/auth0/wp-auth0/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/auth0/wp-auth0/git/refs{/sha}","trees_url":"https://api.github.com/repos/auth0/wp-auth0/git/trees{/sha}","statuses_url":"https://api.github.com/repos/auth0/wp-auth0/statuses/{sha}","languages_url":"https://api.github.com/repos/auth0/wp-auth0/languages","stargazers_url":"https://api.github.com/repos/auth0/wp-auth0/stargazers","contributors_url":"https://api.github.com/repos/auth0/wp-auth0/contributors","subscribers_url":"https://api.github.com/repos/auth0/wp-auth0/subscribers","subscription_url":"https://api.github.com/repos/auth0/wp-auth0/subscription","commits_url":"https://api.github.com/repos/auth0/wp-auth0/commits{/sha}","git_commits_url":"https://api.github.com/repos/auth0/wp-auth0/git/commits{/sha}","comments_url":"https://api.github.com/repos/auth0/wp-auth0/comments{/number}","issue_comment_url":"https://api.github.com/repos/auth0/wp-auth0/issues/comments{/number}","contents_url":"https://api.github.com/repos/auth0/wp-auth0/contents/{+path}","compare_url":"https://api.github.com/repos/auth0/wp-auth0/compare/{base}...{head}","merges_url":"https://api.github.com/repos/auth0/wp-auth0/merges","archive_url":"https://api.github.com/repos/auth0/wp-auth0/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/auth0/wp-auth0/downloads","issues_url":"https://api.github.com/repos/auth0/wp-auth0/issues{/number}","pulls_url":"https://api.github.com/repos/auth0/wp-auth0/pulls{/number}","milestones_url":"https://api.github.com/repos/auth0/wp-auth0/milestones{/number}","notifications_url":"https://api.github.com/repos/auth0/wp-auth0/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/auth0/wp-auth0/labels{/name}","releases_url":"https://api.github.com/repos/auth0/wp-auth0/releases{/id}","deployments_url":"https://api.github.com/repos/auth0/wp-auth0/deployments","created_at":"2014-02-16T20:20:08Z","updated_at":"2018-03-12T20:27:57Z","pushed_at":"2018-03-12T22:02:38Z","git_url":"git://github.com/auth0/wp-auth0.git","ssh_url":"git@github.com:auth0/wp-auth0.git","clone_url":"https://github.com/auth0/wp-auth0.git","svn_url":"https://github.com/auth0/wp-auth0","homepage":"https://auth0.com/wordpress","size":7989,"stargazers_count":65,"watchers_count":65,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":51,"mirror_url":null,"archived":false,"open_issues_count":37,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":51,"open_issues":37,"watchers":65,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/auth0/wp-auth0/pulls/409"},"html":{"href":"https://github.com/auth0/wp-auth0/pull/409"},"issue":{"href":"https://api.github.com/repos/auth0/wp-auth0/issues/409"},"comments":{"href":"https://api.github.com/repos/auth0/wp-auth0/issues/409/comments"},"review_comments":{"href":"https://api.github.com/repos/auth0/wp-auth0/pulls/409/comments"},"review_comment":{"href":"https://api.github.com/repos/auth0/wp-auth0/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/auth0/wp-auth0/pulls/409/commits"},"statuses":{"href":"https://api.github.com/repos/auth0/wp-auth0/statuses/46e20ecf53029b81a0ee82dd664123afa5d6bca4"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"joshcanhelp"}}