Sponsored Content
The Wayback Machine - https://web.archive.org/web/20210817024713/https://github.com/google/site-kit-wp/issues/189
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explanation how to re-activate modules in Settings page #189

Closed
bjackson27 opened this issue Jul 10, 2019 · 10 comments
Closed

Add explanation how to re-activate modules in Settings page #189

bjackson27 opened this issue Jul 10, 2019 · 10 comments

Comments

@bjackson27
Copy link

@bjackson27 bjackson27 commented Jul 10, 2019 •

If a user doesn't approve all scopes, we show an error "not all scopes approved", but no information how to fix that. Add language to tell the user they need to disconnect the service and begin setup from scratch.


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

Acceptance criteria

For cases where the user hasn't approved all requested scopes during the setup, display the following error message:

  • Heading: Site Kit can't access necessary data
  • Text: Site Kit can't access the relevant data from $PRODUCT because you haven't granted all API scopes requested during setup. To use Site Kit, you'll need to redo the setup for $PRODUCT – make sure to approve all API scopes at the authentication stage.
  • Button: Redo setup

The text above should include variants for the following cases:

  • Scopes from multiple services/products are missing
  • We're not able to determine which service/product is responsible for the missing required scope(s)

This is the same message displayed in #1114.

Implementation Brief

In the DashboardAuthAlert component:

  • Change the title prop to Site Kit can't access necessary data
  • Identify product/services missing scopes by parsing the list of unsatisfied scopes from global.googlesitekit.setup.unsatisfiedScopes
  • Parse product/service IDs from each scope in the list https://www.googleapis.com/auth/{productOrServiceID}.potential.other.segments
    • Note: the productOrServiceID above generally maps to a module slug, but there are exceptions (e.g. webmasters -> search-console) which need to be accounted for
    • .potential.other.segments may or may not be present, where it is a dot-separated string irrelevant to the matching of productOrServiceID
  • Set the description prop to Site Kit can't access the relevant data from $PRODUCT because you haven't granted all API scopes requested during setup. To use Site Kit, you'll need to redo the setup for $PRODUCT – make sure to approve all API scopes at the authentication stage. using sprintf to pass the product name.
    • Include a variant that lists the names of multiple products
    • Include a generic variant for handling the rare case where no product or service is inferrable
    • Exact verbaige TBD
  • change the ctaLabel prop to Redo setup

Changelog entry

  • Clarify message for when user needs to reauthenticate to grant required scopes.
@marrrmarrr
Copy link
Collaborator

@marrrmarrr marrrmarrr commented Jul 22, 2019

@bjackson27 presumably this would show up not just in the Settings, but also during the setup process. Do we have screenshots of how this would look during setup? That would help define the acceptance criteria.

@felixarntz
Copy link
Member

@felixarntz felixarntz commented May 6, 2020

IB ✅

@eclarke1 eclarke1 added this to the Sprint 23 milestone May 8, 2020
@ShahAaron ShahAaron self-assigned this May 8, 2020
@ShahAaron ShahAaron removed their assignment May 11, 2020
@cole10up cole10up self-assigned this May 15, 2020
@eclarke1 eclarke1 removed the Next Up label May 18, 2020
@cole10up cole10up assigned cole10up and unassigned cole10up May 21, 2020
@cole10up
Copy link
Collaborator

@cole10up cole10up commented May 22, 2020 •

Tested

Installed latest SK, activated and went through Adsense proxy, canceled after selecting my member. Notice series of strange copy

Site Kit can't access the relevant data from Splash because...

Site Kit can't access the relevant data from Dashboard because...

Site Kit by Google Dashboard ‹ Hellogoodbye — WordPress (3)

image

Sending this back for revision @ShahAaron

@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented May 27, 2020

@felixarntz I suggested that we derive the service/product name from the missing scope(s) which I still think is better than inferring from the screen, but there's a still few problems with this approach to be addressed:

  • The user could have multiple scopes from different services that weren't granted. In this case it would be inaccurate and potentially counter-productive to only name one of them in the notification as the user might only allow the permissions for that service and not for the other.
  • This doesn't take implicit scope satisfaction into consideration when the user has a higher scope already granted where the scope implicitly grants the lower .readonly scope. We've accounted for this on the server-side with the Scopes utility class. Rather than porting this same class to JS, for now I think the simpler solution would be to extend googlesitekit.setup and core/user/data/authentication with a new unsatisfiedScopes key. We need to also make sure we're not using the simple count or array comparison logic for "needsAuth" logic anywhere as this will no longer be accurate.
  • In the case that no product name is matched, we should use an alternate more generic version of the message.
@felixarntz
Copy link
Member

@felixarntz felixarntz commented May 27, 2020

@aaemnnosttv Good catch, I like the approach of including an array of unsatisfiedScopes to the data. Basically this would make needsReauthentication unnecessary, but let's keep it nonetheless as it's just a simple boolean to check.

@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented May 27, 2020

@felixarntz I just updated the AC/IB to include the things we talked about. Let me know if there's anything there I missed.

@felixarntz
Copy link
Member

@felixarntz felixarntz commented May 27, 2020

@aaemnnosttv LGTM!

@ryanwelcher The PR #1586 has been updated with the latest develop. It now includes a OAuth_Client::get_unsatisfied_scopes() method, which you can use here to populate unsatisfiedScopes (in googlesitekit.setup object and core/user/data/authentication API datapoint, see above). It returns the array of scopes that are required but not granted. Essentially it's a more "precise" variant of needsReauthentication (if the array is not empty, needsReauthentication will be true).

@eclarke1 eclarke1 removed this from the Sprint 23 milestone May 28, 2020
@eclarke1 eclarke1 added this to the Sprint 24 milestone May 28, 2020
@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented May 28, 2020

@felixarntz I created a PR with the necessary changes for unsatisfiedScopes which @ryanwelcher should be able to use here until #1599 is merged.

@felixarntz
Copy link
Member

@felixarntz felixarntz commented May 28, 2020

@ryanwelcher @aaemnnosttv #1599 is merged so this should be good to be picked up again!

@cole10up
Copy link
Collaborator

@cole10up cole10up commented Jun 1, 2020

Retested - Looks good on my end.

Passed QA ✅

@felixarntz felixarntz closed this Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants