Improve User Experience when Site Kit Access is not authorised
See original GitHub issueBug Description
Not a bug, but would be good to improve the user experience. When you set up Site Kit (or add a new module) the Google oAuth page appears.
Previously, the access options were checked by default (see screenshot). This meant that when the user clicked continue, they automatically gave authorisation.
With a recent change, the access options are no longer checked by default and it’s easy to continue without noticing. When you click continue you are redirected back to the WordPress dashboard with a vague message.
It would be good for the user to be sent back to the Site Kit dashboard for them to re-authorise, but with a more user-friendly message.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The copy for the
access_denied
error code should be updated as follows:- Instead of The Site Kit setup was interrupted because you did not grant the necessary permissions. To fix this, redo the plugin setup.
- it should be The Site Kit setup was interrupted because you did not grant the necessary permissions. To use Site Kit, you’ll need to redo the plugin setup – make sure to approve all permissions at the authentication stage.
Implementation Brief
In get_authentication_oauth_error_notice
method of Google\Site_Kit\Core\Authentication\Authentication
class,
- Deduplicate the
message
concatenation logic inside$this->credentials->using_proxy()
and its else block by doing the following:- Create a new
setup_url
variable outside the condition block. - Conditionally assign either
proxy url
orsplash url
to it using the current conditional blocks. - Move out
message
concatenation logic from theif-else
block.
- Create a new
- If
$error_code
isaccess_denied
, concatmessage
with the correct wording from the AC. - Otherwise, keep the current message -
To fix this, <a href="%s">redo the plugin setup</a>.
. - In both case, use the
setup_url
as the hyperlink.
Test Coverage
- N/A
Visual Regression Changes
- N/A
QA Brief
!THIS NEEDS TO BE QA’D ON main
BRANCH!
- Connect to sitekit using a fresh google account.
- While in the auth flow, don’t give all the required permission (make sure some of the permissions are unchecked).
- Continue with the auth flow.
- You should get the new error message from the AC.
Changelog entry
- Update handling of OAuth error with clarified language and the URL used for retry.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (1 by maintainers)
@marrrmarrr @aaemnnosttv I’ve added ACs with wording here that is entirely based on the other more accurate message we already have when similar errors happen in the Site Kit dashboard. Please review - if it’s good to go we can move to IB.
@wpdarren Thanks for creating this issue. We’ve seen some confusion about this in the forums as well: