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
Shopify app redirect URL after install shows token number instead app name #23
Comments
Your App URL does not need to be oauth. It can be like the sample "get_products.php" Usually, I would recommend changing line 31 of oauth.php and have a header("_where you want the app to go after auth_"). If you are getting to step 3 http://docs.shopify.com/api/authentication/oauth#confirming-installation
|
The thing is that if I change the App URL to other than oauth.php the app don't wont install |
when the app url and the redirect url both point to oauth.php the app installs fine but if I change the app url for example to get_products.php the app wont install at all |
the SSL is working fine the problem is when I click on the banner of the app from the store admin |
I see what you mean. Without looking at your code, it is hard to tell what the issue is exactly. If you keep oauth.php as your app URL then you will have to change line 31 to a header() type redirect so that you end up in your app after the auth. |
Definitely I cant change the app url to other than oauth.php and I also have the redirect in my code in line 31 redirection to index.php and thats working after iinstall process, the problem is that when I click at the banner of my app in from the store administration is not passing the token here is my oauth.php code: top.location.href='$permission_url '</script>"); } # Step 3: http://docs.shopify.com/api/authentication/oauth#confirming-installation try { # shopify\access_token can throw an exception $oauth_token = shopify\access_token($_GET['shop'], SHOPIFY_APP_API_KEY, SHOPIFY_APP_SHARED_SECRET, $_GET['code']); $_SESSION['oauth_token'] = $oauth_token; $_SESSION['shop'] = $_GET['shop']; header('Location: index.php'); exit(); // redirection here } catch (shopify\ApiException $e) { # HTTP status code was >= 400 or response contained the key 'errors' echo $e; print_R($e->getRequest()); print_R($e->getResponse()); } catch (shopify\CurlException $e) { # cURL error echo $e; print_R($e->getRequest()); print_R($e->getResponse()); } ``` ?> |
to achieve the app installation the app url have to point to oauth.php then when you click on the app from the store admin there is no generating the token and the redirection goes from line 11 of the oauth.php |
What does your index.php look like? What is supposed to happen is that after your app installs, you ask shop for a permanent API key that you store and use it for all future API calls instead. Once you have the permanent API key, you do not have to oauth anymore. what's the URI showing in your browser during the error. (you can mask for security). |
this is the URL |
https://help.shopify.com/api/guides/authentication/oauth#asking-for-permission http://wern-ancheta.com/blog/2013/11/09/getting-started-with-shopify-app-development/ the second uses a different library but may help overcome some of the issues you are having. What is in your index.php? |
Dont know why I cant place the code here wait |
Larry since I have to keep the app url pointing to oauth.php otherwise the app wont install, this also means that after installation the app redirects to oauth and oauth redirects to index.php since there everything ok, but when I click on the banner of my app from the store administration, shopify redirects me to oauth.php(cuz is the app url with redirection to index.php) again but shopify isn't generating any token that's why in that scenario end in line 11 of the oauth.php. what can I do with that ? |
Larry the real problem is that Shopify isn't generating the token when I click on the banner app from the store administration |
Shopify isn't generating the token when I click on the banner app from the store administration once my app have been installed. |
Shopify does not generate a new access token unless the app is uninstalled and reinstalled.
|
I thinks I lost you... see after the app have been installed I click in the app banner from the store administration and that drive me to oauth.php as expected but shows the error of the line 11 of the oauth.php because is not passing the token verification |
That is where your issue is. You do not want your App url to keep re-Authenticating through oauth.php. It already has authenticated and it's up to your app to determine if the request are coming from shopify or not. After a successful authentication, you can ask shopify shop to send you a permanent token to reuse. At that time you no longer need to keep requesting the authorization code but instead make sure the access token is stored in $_SESSION -----> dump that var and see if it is getting set. |
Also, Oauth.php is very simplified and has a basic try catch for errors. Since shopify has a 3 step auth process, this is what usually confuses everyone who attempts to use this lib. And things have changed some which makes your lib not exactly this lib.... |
Here is a good article about Oauth and the mechanics. |
problem solve Larry thanks ! hey I find that the loader bar in my shopify store administration never ends loading when I open my app any idea why ? how can I solve this ? |
Awesome. Curious to know what issue was holding up your app launching in the admin panel? For your app to work in the backend of Shopify you need to enable Embedded App in your developers/partners dashboard. Then you need to link the embedded app js on the page loading (i.e. get_products.php or whereever your app loads) You will find code snippets to add to your page to get you started. |
well as you know I use as App URL oauth.php because without that my app simply don't install dont know why but it is that way so, after install shopify try to call oauth again and when I click the app from the admin panel happens the same thing, so I check for that error and solve the problem redirecting to my index.php from the oauth and thats it |
about the loading in fact my app page loads ok inside the iframe in my admin store view but even after my app loads the blur loading bar in shopify backend keeps loading and visible ... never finish loading, never gets to the end. |
Got it. You were in a redirect loop (code getting to the same place in oauth.php instead of a handler to direct to index.php if session has perm token). Let me know if you need more help with the embedded app code. |
by the way embed app is enable in my partner admin |
great !!!! just keep me posted about the new skeleton. |
You do not absolutely need to use the embedded app. It is just available to give app devs a more clean integration into shopify. Older apps prior to the embedded app was available to devs, simply open the app in a new tab. You can disable embedded app in the partners dashboard to get the old behavior but many devs and shop owners like the integrated look of the embedded app. |
Also here is a style framework that will get your app looking like it should in shopify |
yeah ! thanks I got it, that's the one I am using for the frontend view thanks |
I am using ShopifyApp.Bar.loadingOff() to kill loading spinner event but is not working, looks like the ready stage never happens |
Exactly man !!!! I almost lose my head !!!!! Lol notice I just leave the On Tue, Oct 25, 2016, 13:56 Larry notifications@github.com wrote:
|
Thanks U will share with Shopify as well. |
KK ! take care pal On Tue, 25 Oct 2016 at 14:01 Larry notifications@github.com wrote:
|
You too, thanks |
Larry new issue ! well not an issue just a doubt a big one, my app uses webhooks in this case product create for example and it's working fine, so how could I get the ID of the store that sends the webhook ?? Think that the app will be in more than one store. |
In your app that creates the webhook request, you can append the webhook data with the Shop Id |
Yo my man Larry ! Buddy any advice to realize when a product is back to stock using webhooks ??? since the parameters of inventory_quantity and old_inventory_quantity have always the same value man ? |
What is the product's inventory_management and inventory_policy set to? |
I think the webhook is not the right thing for this. The product event can notify your app of inventory updates. |
and Larry how do I know when a product was sale? cuz I need to take control of product inventory quantity, manually and automatically , for example when a product was sale and the in stock quantity after every sale to check how many item the inventory has and when a client change the inventory amount to 0 manually |
I think there may even be a better way using transfers. It is not well documented but the end point is /admin/transfers.json |
hummm |
is is any way I can set this from my the app to all products ? |
Yea. I would make the app create the custom collection(s) and query them when the app event is triggered to see which products have ended up in the collection(s) and have the app do any further processing on those products you require. |
well remember I'm talking about a general app not a private one, likely to do a back to stock notification |
Larry it is any way I can simulate an orders/paid from my development store ? |
yea, enable the test gateway in your checkout settings. |
how I cant find it |
My bad, it is in payments. |
KK |
@alexandprivate If you are comfortable with Model View Controller programming than Ruby on Rails will just fit right in. But if not it is not that hard to learn and make work for you. It is night and day different than PHP (although there are tons of MVC php (cake ignite symphony etc....) The main reason for me to move away from this lib is that any thing you want you have to write tons of code to get there but with the official Shopify_App, there is likely already a provision to do it or a Gem you can add quickly. Also ruby makes this a modular approach so separating code is quite easy. |
Thanks a lot man for your concern, really appreciate you help, thank you, I will give it a try to ruby, so be ready for issues here ! LOL, thanks pal. |
no problem. I think we should start a channel or use Shopify's IIRC (it has a web client so no worries there.). One issue with this php shopify api is that it has not had any movement other than our discussions in a while. (this is an open issue we are using for chat purposes.). Let me know if you want to hang out and chat on another platform or continue using this as that... |
no problem man, whatever you feel confortable with, it could be an slack On Wed, 2 Nov 2016 at 11:45 Larry notifications@github.com wrote:
|
may need your email to invite. |
hello@alexdesignfor.me let's do it ! |
Hello I'm facing same issue for outh.php I have to keep the app url pointing to oauth.php otherwise the app wont install, this also means that after installation the app redirects to oauth and oauth redirects to index.php since there everything ok, but when I click on the banner of my app from the store administration, shopify redirects me to oauth.php and again it is checking for "is_valid_request". which results "Invalid Request! Request or redirect did not come from Shopify" Please help :( |
Hi Larry, I am having and issue now, after my app have been authorized by the store and the installation process ends, I get redirect to the store administrator to my app view in the iframe but, the URL showed is containing the token number and instead the app name like this
https://hekities.myshopify.com/admin/apps/token-number-here/index.php
when it should be like this
https://hekities.myshopify.com/admin/apps/my-app
Also after load my app view the store remain loading like if were calling for more resources, even when my app shows perfectly. On the other hand when I leave this view and go to general app view in at store and click on my app I get the perfect URL, I mean this URL:
https://hekities.myshopify.com/admin/apps/my-app
but isn't passing the token number and shows this in the iframe:
Invalid Request! Request or redirect did not come from Shopify
so is going for the die part of the function because is nor passing the token number !
well this are two issues really I attached the view from the error when I click the app from the store admin and my app config
The text was updated successfully, but these errors were encountered: