diff --git a/includes/Core/Authentication/Authentication.php b/includes/Core/Authentication/Authentication.php index 3b8563d7cf0..8555f950693 100644 --- a/includes/Core/Authentication/Authentication.php +++ b/includes/Core/Authentication/Authentication.php @@ -1077,14 +1077,22 @@ private function get_authentication_oauth_error_notice() { return ''; } - $message = $auth_client->get_error_message( $error_code ); - $access_code = $this->user_options->get( OAuth_Client::OPTION_PROXY_ACCESS_CODE ); + $message = $auth_client->get_error_message( $error_code ); - if ( $this->credentials->using_proxy() ) { + if ( $this->is_authenticated() ) { + + $setup_url = $this->get_connect_url(); + + } elseif ( $this->credentials->using_proxy() ) { + + $access_code = $this->user_options->get( OAuth_Client::OPTION_PROXY_ACCESS_CODE ); $setup_url = $auth_client->get_proxy_setup_url( $access_code ); $this->user_options->delete( OAuth_Client::OPTION_PROXY_ACCESS_CODE ); + } else { + $setup_url = $this->context->admin_url( 'splash' ); + } if ( 'access_denied' === $error_code ) {