Closed tofumatt closed 1 day ago
Thanks @zutigrm – I actually meant to put this into IBR but no problem. In light of new developments on the external side, I've made an update to the AC. The main change is that we'll no longer be passing a redirecturi
to the external project provisioning service. See also #9677 which I just opened although I think this issue can happen in parallel since this one is more about changes to the setup.
I've also removed the point about changing the action parameter, as this is already happening/done in https://github.com/google/site-kit-wp/pull/9577/files#diff-5d9448f7515540d9d39cb7f666fd5dc594af902a96aef39a181a6de355263e3aR58
- Add public static method
get_google_login_url
I'd suggest calling thisget_auth_url
since the prefix is redundant being on the "SiwG" class :) It also probably doesn't need to be static since it will only be used internally as of #9677Update
Google\Site_Kit\Core\Assets\Assets::get_inline_base_data
- In
$inline_data
add new item to the array:loginURL
, with value ofGoogle\Site_Kit\Modules\Sign_In_With_Google::get_google_login_url()
I don't think this will be necessary now since we'll only need the login endpoint in PHP when rendering the button.
Add
getLoginEndpointURL
selector
Wrap it with
createRegistrySelector
and retrieve following data:
siteName
usinggetSiteName
selector fromCORE_SITE
storehomeURL
usinggetHomeURL
selector fromCORE_SITE
storesupportEmail
usinggetEmail
selector fromCORE_USER
store*redirecturi
using newly created selectorgetLoginURL
fromCORE_SITE
store- Define new constant
loginEndpointURL
and assign it value ofhttps://developers.google.com/identity/site-kit
There seems to be some confusion here, but at the least, it's confusing to have very similarly named selectors for different things. The login endpoint is what we mean by the URL constructed from wp_login_url
that login requests will be sent to. The developers.google.com/identity/site-kit
based URL is really the SiwG module's "service URL" similar to other modules, so we can follow that pattern here as those all use AccountChooser URLs as well.
All in all, I think it will be substantially smaller to do so the estimate should be able to come down as well.
@aaemnnosttv Thanks, I update the IB following the feedback and AC change.
Add public static method get_google_login_url I'd suggest calling this get_auth_url since the prefix is redundant being on the "SiwG" class :) It also probably doesn't need to be static since it will only be used internally as of https://github.com/google/site-kit-wp/issues/9677
Since we no longer need login URL within the scope of this issue, I removed this part, as it can be done in the referenced issue if needed.
Thanks @zutigrm
IB ✅
@tofumatt @jimmymadon we need to make a very small change to this issue as it isn't worth creating a new one over. I'll tweak the AC accordingly but essentially the only change is as follows
- siteurl: The home URL of the site (front page root): use home URL (not reference URL)
+ siteorigin: The origin of the site root/home URL
Get Client ID URL
button decoded as per AC.
Feature Description
The "Get your Client ID" URL should be updated to the new SiwG-specific URL for Site Kit.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
https://developers.google.com/identity/site-kit
with the following URL-encoded parameters:appname
: The display name of the Google Cloud project: use site titlesitename
: The display name of the site: use site titlesiteurl
: The home URL of the site (front page root): use home URL (not reference URL)siteorigin
: The origin of the site root URL (scheme+hostname only)supportemail
: The email for support with the app: use the Google address of the user setting up SiwG (i.e. module owner)Implementation Brief
assets/js/modules/sign-in-with-google/datastore/service.js
getServiceURL
selectorcreateRegistrySelector
and retrieve following data:siteName
usinggetSiteName
selector fromCORE_SITE
storehomeURL
usinggetHomeURL
selector fromCORE_SITE
storesupportEmail
usinggetEmail
selector fromCORE_USER
storeserviceURL
and assign it value ofhttps://developers.google.com/identity/site-kit
addQueryArgs
usingserviceURL
as the first parameter, and object as the secondgetAccountChooserURL
selector fromCORE_USER
store, and return the resultassets/js/modules/sign-in-with-google/components/setup/SetupForm.js
getServiceURL
selector from SiWG module store to retrieve the URL and use it in theButton
component, replacing the existinghref
URLTest Coverage
QA Brief
Get Client ID URL
button on the form and paste it inside an online URL decoder to check the new params are as per the AC. Note that 2 of the params (siteurl and supportemail) are "double" encoded, i.e. they will still be encoded after decoding once. This is expected.Changelog entry