-
-
Notifications
You must be signed in to change notification settings - Fork 376
Osiset\ShopifyApp\Exceptions\MissingShopDomainException #594
Comments
same issue |
Same issue here |
Any updates |
Same issue, and this is the issue with authentication by Shopify middleware, this error happens when you are not logged in and when logged in you will experience another error of redirecting to shopify. I haven't figured out the solution but it has to do with redirecting the URL in the homepage. I think it's in window['app-bridge'].actions.Redirect = (AppBridge.actions.Redirect) |
Yeah... same issue... |
I found some temporary relief by making the following changes to my Session config:
|
Does not work for me. It's the same as before. |
getting same error |
this is the issue with latest version of laravel now i installed laravel 7 and then follow the docs and app is running |
@tameemahmad mine is not working even after a fresh installation of laravel 7. How did you make it work? |
In Or Hit your app url like: |
@awebartisan How to implement login functionality? Please, If you can guide me that would be great! |
Not tested but following steps will do:
Hope it helps. |
In my case, redirection to http:// scheme URL cause this problem. Adding forceScheme line to app/Providers/AppServiceProvider.php fixes this problem.
I think it's because I use ngrok to serve https. HTTP_X_FORWARDED_PROTO header value is 'https' but laravel8 doesn't use the value and Redirect::route('home') returns http scheme URL. I hope this helps |
Hello @awebartisan, Also, I've added auth.shopify in the middleware. Can you please guide me, What code will I add in login.blade.php? I am new to the laravel. Thanks in advance |
Hi @awebartisan, I followed the steps as you had suggested Create a /login route After adding these -- Can you please suggest |
Hi @sunil209 , what does your |
Hi @awebartisan , Below is screenshot of APP url and Allowed redirections |
@sunil209 it would be better to open a separate issue for this. With |
I'm ussing "laravel/framework": "^7.24" but I still have the same error. |
I hit direct to https://domain.local?shop=shop.myshopify.com and it works! Thanks, "laravel/framework": "^7.24"
"osiset/laravel-shopify": "^14.0" |
Hi, Sorry for the wrong comment earlier. This issue has to be sorted with two routes. in web.php (routes) Route::get('/', function () {
return view('welcome');
})->middleware(['auth'])->name('home');
Route::get('/shop', function () {
return redirect()->route('home');
})->middleware(['auth.shopify'])->name('shop'); login blade <form method="GET" action="{{ route('shop') }}"> I hope this helps. @awebartisan I hope this can be documented in the installation. |
@gnanakeethan Feel free to make a wiki entry for others. |
Hi, first of all. Thanks to @osiset for his awesome job. You saved us a lot of time in Shopify apps development 🙏. The problem with @gnanakeethan solution (which is working fine) is that it doesn't solve the main problem, which is when we access the For me this is what i did. In web.php (routes) Route::get('/login', function () {
if (Auth::user()) {
return redirect()->route('home');
}
return view('login');
})->name('login');
Route::middleware(['auth.shopify'])->group(function () {
Route::get('/', function () {
return view('welcome');
})->name('home');
// Other routes that need the shop user
}); In login.blade.php <form method="GET" action="{{ route('home') }}">
<input type="text" name="shop"/>
<button type="submit">Submit</button>
</form> In app/Exceptions/Handler.php public function render($request, Throwable $exception)
{
if ($exception instanceof MissingShopDomainException) {
return Redirect::secure('login');
}
return parent::render($request, $exception);
} And finally, don't forget the tip from @shota (not mandatory), which well help in local development using public function boot()
{
URL::forceScheme('https');
} I hope this helps if the @gnanakeethan solution doesn't sweet your needs. |
I tried everything but still the same issues for Laravel 8. I am facing the issues only in case i am not logged to Shopify admin if i am already logged in its working fine. I mean its not asking for login page like the other app. May be somewhere need to check for auth. I might be wrong because i am new to Shopify and my app is not public and I am hitting the domain URL directly from browser where i am not logged in with Shopify admin. Please guide :) |
@kantsverma just make sure that you have a route named 'login' (which is public, doesn't have any middleware) in routes, and the render function in your ExceptionHandler. if the error still persist, you can share with me a basic project that has the problem and i will check it for you. |
@Masix i followed the all steps you mentioned then i got below error Then i add this use Illuminate\Support\Facades\URL; In app/Providers/AppServiceProvider.php After that i run the the commands But still the same error , but error are only in case of i am not logged in to Shopify App admin else its working fine. |
After spending few hours i fixed the issues. Please follow the steps
|
@makhchan @mooezz999 I was able to replicate the same issue when I have the "forceRedirect" set to false in the default.blade.php file script section. Once that is "false", I have my test app running outside my shopify store via ex: myshopifyapp.test in chrome browser, and also still viewing the test app inside the shopify store instance in another separate tab. I do get redirected to Osiset\ShopifyApp\Exceptions\MissingShopDomainException error page when both app instances are open, and I'm viewing the same page/route in both apps. One of the apps will send an MissingShopDomainException error at random. This is all I could reproduce on my side. So I just pick which one I want to development in, or set "forceRedirect" to true to just have your local app address redirect to your shopify store app and use that instead. |
@Dwhyte Where did you get this default.blade.php code from? Can you send me the code in default.blade.php please? |
@mooezz999 you already have it. All you need to do is run this command in your app terminal - php artisan vendor:publish then select the number option for "shopify-views". This will generate a vendor folder in your views directory with all those blade files. :) |
I'm also stuck with the redirect issue. vendor/osiset/laravel-shopify/src/ShopifyApp/Http/Middleware/AuthShopify.php:68
And That cause the MissingShopDomainException :
Hope someone can do a PR for this one soon, @osiset will appreciate your support on this, really blocked many developers as I see. |
So is this only happening when you click on a route inside your app? |
My app is working just fine in chrome browser. if i click a route inside app it redirects me to expected page without any issues, but as soon as i move to some other browser like firefox and i click some route within it is throwing the same exception. (I'm using "osiset/laravel-shopify": "15.*" ) |
So if I understand. Chrome: You open app... all is fine. You click on a route inside the app... all is fine. Firefox: You open app... all is fine. You click on a route inside the app... error shows. Is that correct? Edit: To me it sounds like either the Laravel Session is lost, or I'm not checking for it in the middleware, which I'm pretty sure I am. If I am checking, then this goes back to the cookie issues I believe. |
@osiset yes this is right, its happening on firefox for me |
I confirm for FF, I didn't test on chrome will do and see if it is working fine and confirm back here. |
this one solve the issues for me |
@raihan004 the above code just redirects to login page in case of MissingShopDomainException, it doesn't fix the real issue, why we face MissingShopDomainException when navigating on the app.. |
@osiset
I think also it is related to lost a session where this info are searched for.. |
Looking more into the issue, Single Page applications will not have this issue. Some related (old) subjects :
Getting hmac from cookies or custom session can be a solution. |
Hmm I think the issue may be pulling the domain from the data. If they are logged in, I should pull the domain from the user model... @redamakhchan Are you able to confirm if the user is logged in on your first and second navigation? If you open src/ShopifyApp/Http/Middleware/AuthShopify.php and at line 84 (blank line), add:
If the user session is still active, the log should show, and in that case, the error lies there in trying to pull from data when it should pull from the user model first, then data as a secondary. |
@osiset I confirm, Logs :
|
Hmm thanks. Ill try to reproduce. |
Though my testing I can confirm this is a cookie issue. The cookie is never set, this Auth::user is always null. I've tried to quickly debug this by:
I can see the samesite test cookie is set, however, when going back into the app, cookies are not there and browser warns of a third party attempting to set cookies. I'll close this for #522 ... I do not have a solution for this right now, I need help on this, but at least I'm able to reproduce. |
URL import package name? |
Anything new on this? Still got the issue. |
On browser you cannot run directly.
For this you have to first login with store account and then open our app.
One more thing that in current app I'm using my local url so if you want to use this then please set your ngrox https urla via the devwloper partners account
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: Kevin Hansen <notifications@github.com>
Sent: Tuesday, February 23, 2021 1:58:49 PM
To: osiset/laravel-shopify <laravel-shopify@noreply.github.com>
Cc: Sagar Choudhary <sagar.choudhary@intimetec.com>; Comment <comment@noreply.github.com>
Subject: Re: [osiset/laravel-shopify] Osiset\ShopifyApp\Exceptions\MissingShopDomainException (#594)
** External: Do not click links or open attachments unless you trust the sender.**
________________________________
Anything new on this?
Still got the issue.
Osiset\ShopifyApp\Exceptions\MissingShopDomainException
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#594 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ASMSNWGU2YBMFFQU5MWIOY3TANRMDANCNFSM4R3PYFZA>.
________________________________
This message and any attachments are confidential and intended solely for the addressees. Any unauthorized use or disclosure, either whole or partial, is prohibited. E-mails are susceptible to alteration. InTimeTec shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
|
Same my issue, are you getting any solution about this issue? |
Same issue. Stuck on error: Osiset\ShopifyApp\Exceptions\MissingShopDomainException |
Hi
When you hit from browser then you get this error but if you will hit from admin panel then you will not get any error.
Thanks
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: humanovirtual ***@***.***>
Sent: Friday, March 26, 2021 2:45:37 AM
To: osiset/laravel-shopify ***@***.***>
Cc: Sagar Choudhary ***@***.***>; Comment ***@***.***>
Subject: Re: [osiset/laravel-shopify] Osiset\ShopifyApp\Exceptions\MissingShopDomainException (#594)
** External: Do not click links or open attachments unless you trust the sender.**
________________________________
Everything works as normal for me. Keep everything the same based on the https://github.com/osiset/laravel-shopify/wiki/Installation guide.
I'm using Laravel v8
!! Just make sure to create a development store in your https://partners.shopify.com/ account.
When you create an app, go back into the main home page of your app and scroll down to the bottom.
Select "Test your app". Then hit "Select Store".
At that point, either create a development store if you haven't done so already and select "install app" on the far right of your selected created store.
You will reach another page telling you to finally install your app into your development store.
Watch this video and follow along carefully. - https://www.youtube.com/watch?v=7U_skSqlI1E&list=PLB4AdipoHpxbE0ldfsNobTSZm2tUBW9GR&index=2&t=437s
Hope this helps anyone who is stuck.
@Dwhyte<https://github.com/Dwhyte> The installation & login to store works fine, issue is when you navigate to other routes, it takes you back to login page MissingShopDomainException.
@mooezz999<https://github.com/mooezz999> @jasontxf<https://github.com/jasontxf> is navigation to other pages works fine for you ?
My case am connected to the app on store, I move to products page it works, 2nd time I click any link it shows the exception MissingShopDomainException
Same my issue, are you getting any solution about this issue?
Same issue. Stuck on error: Osiset\ShopifyApp\Exceptions\MissingShopDomainException
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#594 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ASMSNWBN4AUZHWK6GOAKKTTTFORXTANCNFSM4R3PYFZA>.
________________________________
This message and any attachments are confidential and intended solely for the addressees. Any unauthorized use or disclosure, either whole or partial, is prohibited. E-mails are susceptible to alteration. InTimeTec shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
|
Hello everyone, I faced this issue also, and I did fix by setting
Happy coding. |
Rather than changing your app's cookie settings, you can instead just trigger a redirect (or do anything you want) whenever In For example, in my app I am redirecting to a route that displays a message to the user letting them know that their login can't be verified, and instructing them to reload our app from their Shopify admin: public function register(): void
{
// redirect to the "unable to verify your login" error message
$this->renderable(function (MissingShopDomainException $e) {
return redirect()->route('apps.shopify.no-auth');
});
} One important thing to remember is that the user is not authenticated when they access the route that you redirect them to, so you will need to register the route without the I manually register all of the app routes (instead of letting the package register them) and I've broken them into separate files, but I'll put this here in case anybody is curious how to accomplish what I said in the previous paragraph: Route::middleware('web')
->group(function () {
// the user isn't logged in
require base_path('routes/apps/shopify/no-auth.php');
Route::middleware('itp')
->group(function () {
require base_path('routes/apps/shopify/itp.php');
Route::middleware('auth.shopify')
->group(function () {
// ...authenticated app routes...
});
});
}); You will also need to make sure that your views recognize that the user isn't logged in and don't attempt to display shop info, user info, etc. You can do that with |
Thank you all. When I solved this issue, I faced another one (same site issue) I moved app from local server to heroku and everything works fine. Thanks. |
Thanks a lot @oayoub84 it worked for me |
This works for me. But instead |
If you are using larave 8 and want to handle the exception "MissingShopDomainException" then you can handle this exception using handler.php in laravel. Go to app->Exceptions->Handler and write below code: use Osiset\ShopifyApp\Exceptions\MissingShopDomainException; and inside function register write: This will redirect to the shopify login page when anyone will try to hit the base url without login. |
I am getting MissingShopDomainException upon running the app. This is a fresh laravel 8.6.0
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
The text was updated successfully, but these errors were encountered: