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 host to query param and consume App Bridge v2 #1376

Merged
merged 5 commits into from
Mar 2, 2022

Conversation

henrytao-me
Copy link
Member

@henrytao-me henrytao-me commented Feb 25, 2022

What this PR does

Resolves https://github.com/Shopify/app-bridge/issues/2195

Reviewer's guide to testing

Things to focus on

Test environment:

  • Ruby 3.0.3p157
  • Rails 6.0.4.6
  • Bundler 2.3.5
  • Node v17.4.0
  1. Clone this branch
  2. In a terminal, use Shopify CLI to create and configure a new rails app: shopify app create rails
  3. In an editor, open the Gemfile inside the newly created app. Modify the entry to shopify_app to point to this branch in your local environment so that it looks similar to this: gem 'shopify_app', path: '~/src/github.com/Shopify/shopify_app'
  4. Run yarn add @rails/webpacker. For some reason, my environment doesn't have rails/webpacker by default
  5. Run ./bin/webpack
  6. Start your app server with shopify app serve, this will also output a ngrok url
  7. You could add below code to app/assets/javascripts/shopify_app/redirect.js to see more output in console
    console.log('eeeeeeeee app-bridge v2', {
      href: location.href,
      'window.top === window.self': window.top === window.self,
    });

Test new installation flow

  1. In a browser, follow the ngrok url to install the app on a test store. It should look similar to this: https://82f1-72-141-27-79.ngrok.io/login?shop=greats-clone.myshopify.com
  2. Expect the app is installed as normal to the test shop

Screen Shot 2022-03-01 at 15 03 52

Test the login page on shop already has the app installed

  1. Open the login url again
  2. Expect the app is installed as normal to the test shop

Test re-authentication. Ex: cookies is expired

  1. Open db/development.sqlite3 with https://kepler.shopifycloud.com/services/db-browser-for-sqlite
  2. Find shop table and delete your test shop
  3. Open the embedded app from the apps list in your test shop
  4. Expect the app is opened as normal

Screen Shot 2022-03-01 at 14 54 43

Test AppStore installation flow

Screen Shot 2022-03-02 at 10 35 37

Test ITP

  • Repeat the same tests above on Safari.
  • Expect to see following screens in the re-authentication case.

Screen Shot 2022-03-01 at 15 51 32

Screen Shot 2022-03-01 at 16 05 42

Screen Shot 2022-03-01 at 16 05 55

Note: if you click Don't allow in the ITP screen, you will be redirected to the apps list. The ITP screen will show up again every time you open embedded apps.

Checklist

Before submitting the PR, please consider if any of the following are needed:

  • Update CHANGELOG.md if the changes would impact users
  • Update README.md, if appropriate.
  • Update any relevant pages in /docs, if necessary
  • For security fixes, the Disclosure Policy must be followed.

@henrytao-me henrytao-me force-pushed the issue/app-bridge/2195/app-bridge-v2 branch from 29cd7d4 to e70c291 Compare March 1, 2022 21:09
@henrytao-me henrytao-me marked this pull request as ready for review March 1, 2022 21:25
@SeanyB
Copy link
Contributor

SeanyB commented Mar 2, 2022

Given the issue we are experiencing with the @shopify/koa-shopify-auth using AB 2, can we test installing an app using this shopify_app gem using AB 2.0 before we officially release it?

Copy link
Contributor

@hannachen hannachen left a comment

Choose a reason for hiding this comment

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

Thank you for the fix...! 🎩 w/ Henry demoing the changes 👍

@SeanyB
Copy link
Contributor

SeanyB commented Mar 2, 2022

If it's tophatted, let's ship it! 🚀 😄

@henrytao-me henrytao-me merged commit 31b5019 into master Mar 2, 2022
@henrytao-me henrytao-me deleted the issue/app-bridge/2195/app-bridge-v2 branch March 2, 2022 18:17
This was referenced Mar 2, 2022
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems March 3, 2022 15:09 Inactive
@yourivdlans yourivdlans mentioned this pull request Mar 9, 2022
4 tasks
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems April 6, 2022 18:22 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems-v18 June 3, 2022 14:59 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants