Skip to content

When actioning the "reauthentication needed" admin notice, an interrupted module setup flow should continue. #11989

@techanvil

Description

@techanvil

Feature Description

If the user has unsatisfied scopes, this notice is shown on the WordPress admin pages:

Image

In the case where a module's setup flow is interrupted before granting OAuth, clicking the link takes the user through OAuth but doesn't continue with the module setup flow.

In this scenario, the module setup flow should continue after the user has granted the required scopes.

We should follow up with a separate issue to tailor the notice message for this scenario, or further improve the UX.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • If a module's setup flow is interrupted before granting OAuth and the link in the reauthentication notice shown on WP admin pages is clicked, the module setup flow should continue after the user has granted the required scopes.

Implementation Brief

  • Update the JS snippet in the Authentication::get_reauthentication_needed_notice() method.
    • Look up the module_setup item in localStorage and sessionStorage.
    • If found, extract the module slug from the item and use it to redirect to the module setup flow.
    • If not found, clear the storage and redirect to the connect URL as per the current implementation.
    • Complete this PR.

Test Coverage

  • Add E2E tests for the above changes.

QA Brief

  • Set up Site Kit without Analytics
  • Go to your Google account and revoke Site Kit access
  • Go back to Site Kit dashboard and try to set up Analytics. Once you're redirect to complete authentication, abandon the flow
  • Ensure the admin notice is now visible in the WP dashboard (not SK dashboard)
  • Click the "Click here" button and complete authentication this time
  • Ensure that you are redirected to complete the previously abandoned Analytics setup

Changelog entry

  • Enhance the reauthentication admin notice to continue an interrupted module setup flow after the user grants the required scopes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Medium priorityTeam MIssues for Squad 2Type: EnhancementImprovement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions