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

Rename redirect_url to store_url in the state parameter #2396

Merged

Conversation

ianlin
Copy link
Contributor

@ianlin ianlin commented May 10, 2024

Changes proposed in this Pull Request:

Part of #2146, this PR renames redirect_url to store_url, so it will not be confused with redirect_uri.

The store_url is merchant's store URL, which Google will help redirect to after the OAuth2 flow is completed.

Note that after the PR is merged we also need to update the internal document about the new parameter name.
Internal doc link: PCYsg-Ypu-p2

Screenshots:

Detailed test instructions:

Prerequisite

  1. Make sure the notification is enabled by setting add_filter( 'woocommerce_gla_notifications_enabled', '__return_true' ).
  2. Make sure the options gla_wpcom_rest_api_status is not in the DB.

Test steps

  1. Complete the onboarding and go to the settings page.
  2. Click Enable new product sync from the top-left banner.
  3. Complete the OAuth flow.
  4. For now you will be redirected to https://woocommerce.com
  5. From the URL, copy the value of state parameter, which is base64 encoded.
  6. Decode the base64 string, make sure the content includes store_url param
    echo '<your-base64-string>' | base64 --decode

Additional details:

Changelog entry

Tweak - Rename redirect_url to store_url in the state parameter

@ianlin ianlin requested a review from a team May 10, 2024 07:45
@ianlin ianlin self-assigned this May 10, 2024
@github-actions github-actions bot added the changelog: tweak Small change, that isn't actually very important. label May 10, 2024
*
* where its URL decoded version is:
* nonce=nonce-123&redirect_url=https://merchant-site.example.com/wp-admin/admin.php?page=wc-admin&path=/google/setup-mc
* nonce=nonce-123&store_url=https://merchant-site.example.com/wp-admin/admin.php?page=wc-admin&path=/google/setup-mc
*
* @param string $path An URL parameter for the path within GL&A page, which will be added in the merchant redirect URL.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not introduced in this PR but in line 66 "An URL" seems not correct and it should be "A URL".

Copy link
Contributor

@puntope puntope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank @ianlin LGTM

Screenshot 2024-05-10 at 18 00 26

@ianlin ianlin merged commit c7537af into feature/google-api-project May 13, 2024
10 checks passed
@ianlin ianlin deleted the tweak/rename-redirect-url-to-store-url branch May 13, 2024 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: tweak Small change, that isn't actually very important.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants