tiki-bar / app-shopify-extensions

Integrate mytiki.com with your Shopify Store
https://mytiki.com
GNU Affero General Public License v3.0
2 stars 0 forks source link

Add index route with auth redirect #38

Closed ricardobrg closed 11 months ago

ricardobrg commented 12 months ago

As a developer I want to use the root as the app URL in Shopify so that it follows the standards for static web application

What it is now

The Shopify app URL is /api/latest/oauth/authorize. When the app is loaded, it checks if the token is valid and redirects the user to the app root, where the home screen is shown. If the token is invalid it starts the oauth flow. That is an anti-pattern, since oauth/authorize should be used just to start the oauth flow.

What it should be

The Shopify app url should be /. When the app is loaded, it should check if the token is valid and redirect the user to the app root, where the home screen is shown. If the token is invalid it should redirect the user to /oauth/authorize which starts the oauth flow.

Technical details

Add the / route. In this route check if the token is valid and show the home screen. If not, redirect to oauth endpoint.

Acceptance criteria

  1. Change app URL to the root path
  2. After these changes the app can be installed/uninstalled without errors.