gnikyt / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
1.24k stars 374 forks source link

Session in Safari browser - Issue #950

Closed KevinSHansen closed 2 years ago

KevinSHansen commented 3 years ago

For bug reporting only! If you're posting a feature request or discussion, please ignore.

Expected Behavior

The app is working perfect in Chrome with session, but as soon as i open the app in Safari the user isnt authorized.

Current Behavior

Auth is never set in Safari and Shopify have been denying the app for this before.

Failure Information

Using v17.0.1 and updated everything to use Sessions.

Steps to Reproduce

Updated to v17.0.1 and followed the upgrade guide.

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

{ "class": "Facade\\Ignition\\Exceptions\\ViewException", "message": "Attempt to read property \"name\" on null (View: /var/www/html/vendor/osiset/laravel-shopify/src/resources/views/layouts/default.blade.php)", "code": 0, "file": "/var/www/html/vendor/osiset/laravel-shopify/src/resources/views/layouts/default.blade.php:33", "trace": [ "/var/www/html/vendor/osiset/laravel-shopify/src/resources/views/layouts/default.blade.php:33", "/var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:107", "/var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:108", "/var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:58", "/var/www/html/vendor/livewire/livewire/src/ComponentConcerns/RendersLivewireComponents.php:35", "/var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php:61", "/var/www/html/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php:37", "/var/www/html/vendor/laravel/framework/src/Illuminate/View/View.php:139", "/var/www/html/vendor/laravel/framework/src/Illuminate/View/View.php:122", "/var/www/html/vendor/laravel/framework/src/Illuminate/View/View.php:91", "/var/www/html/vendor/osiset/laravel-shopify/src/resources/views/auth/token.blade.php:45", "/var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:107", "/var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:108", "/var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:58", "/var/www/html/vendor/livewire/livewire/src/ComponentConcerns/RendersLivewireComponents.php:35", "/var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php:61", "/var/www/html/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php:37", "/var/www/html/ve

ghost commented 3 years ago

1) you are not using the right middleware (verify.shopify) 2) you haven't updated the connected appbridge in default.blade.php and you haven't added blade templates to update the token.

LonnyX commented 3 years ago

I have the same issue @enmaboya point 1 & 2 are OK

PS:

After some research it looks like on Safari, the Prevent cross-site tracking is enabled by default. That means that referrer being set to the domain only, without the URI..

And of course $shop is extracted from the referrer (WITHOUT URI) .. that means User will not be logged after navigating.

See here: https://github.com/osiset/laravel-shopify/blob/master/src/Objects/Values/ShopDomain.php#L55

This i a bug

LonnyX commented 3 years ago

I posted a PR to fix this issue, hope it'll quickly be accepted 🙏

Kyon147 commented 2 years ago

Fixed in #956