Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
353 stars 102 forks source link

SessionToken not read during verify.shopify process #146

Closed johnGates10 closed 1 year ago

johnGates10 commented 1 year ago

For bug reporting only! If you're posting a feature request or discussion, please ignore. Hello, I have an issue with verify.shopify process. when routing using middleware verify.shopify , the sessiontoken is never read in token.blade.php this code return pending promise always and do not redirect to target. utils.getSessionToken(app).then((token) => { window.location.href = {!! $target !!}{!! Str::contains($target, '?') ? '&' : '?' !!}token=${token}{{ Str::contains($target, 'host')? '' : '&host=${host}'}}; });

Expected Behavior

sessiontoken read and page redirected to target

Current Behavior

sessiontoken not read , no routing

Failure Information

blank page

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

1.install 18.0.1 or 17.4 on laravel ( 8 or 9 or 10 ) php (8.0 or 8.1)

  1. create a simple user controller and route Route::get( '/user', [UserController::class, 'index'])->middleware(['verify.shopify','billable'])->name('user');
  2. create a welcome.balde.php with this link : user
  3. configuration the .env SHOPIFY_APPBRIDGE_ENABLED=1 SHOPIFY_APPBRIDGE_VERSION=latest

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Failure Logs

Please include any relevant log snippets or files here.

johnGates10 commented 1 year ago

I noticed that the host parameter for appbridge is missing after passing throw the verify.shopify middleware this explains all . var AppBridge = window['app-bridge']; var actions = AppBridge.actions; var utils = window['app-bridge-utils']; var createApp = AppBridge.default; var app = createApp({ apiKey: "xxxxxxxxxxxxx", host: "", forceRedirect: true, });

my next question what to do about it . thank you

Kyon147 commented 1 year ago

@johnGates10 does the initial load work fine i.e the home route? If so, then make sure you are passing host along to every route you are trying to access.

On blade mode, you need to make sure you are passes the param on every route change i.e. every link clicked etc.

johnGates10 commented 1 year ago

thank you I'm in BLADE mode indeed and the initial load works fine. could you give me a route example please.

Kyon147 commented 1 year ago

@johnGates10 everything should be in the wiki https://github.com/Kyon147/laravel-shopify/wiki/Authentication-Process

Going to close this issue for now, as it sounds like a set up issue not a bug.