phpish / shopify_app-skeleton

Skeleton Shopify App project using phpish/shopify
94 stars 41 forks source link

Seeing App in Store #8

Open ghost opened 9 years ago

ghost commented 9 years ago

Will you actually see the app installed in the store? I followed instructions and just got an empty page when I went to http://mysite.com/install.php?shop=devshop.myshopify.com

I went back to the shopify dev shop and didnt see the app installed.

myjanky commented 9 years ago

You need to replace mysite.com with your app domain and shop= your shopify domain. Forgive me if you are just using these to protect the location of your shop and app.

ghost commented 9 years ago

yes, i used my app sight and dev shop address. does there need to be https:// in front of the devshop url? @myjanky

myjanky commented 9 years ago

Yes HTTPS is the only way to get it to work. Do you have aa valid SSL cert ( not self signed)?

And yes you will see the install in your partners dashboard if all went well.

BTW. The callback URL should point to the index.php And the redirect URL should be exactly the same as the one in the app settings. If you get the 400 error check the redirect_url query parameter in the url bar in the browser.

ghost commented 9 years ago

I don't get any errors. It just shows the blank install.php page and I check the Dev store and it is not installed.

myjanky commented 9 years ago

You may need to delete the index.html file if you cloned. Most web servers are set to any format index file as the root document

ghost commented 9 years ago

I tried that. Where do I access where the callback URL goes? The only place on app setting is in the redirect url. Sorry so many questions. Just banging my head as to why this isnt working

ghost commented 9 years ago

Found it! Thanks for your help @myjanky

ghost commented 9 years ago

so now I get this Oauth error invalid_request: The redirect_uri is missing or not whitelisted

myjanky commented 9 years ago

Make sure the query parameter for the redirect URL is the same as the one in the app settings.

ghost commented 9 years ago

where do I find that? in oauth? Sorry for being ignorant in this.

myjanky commented 9 years ago

No apologies needed. I was once where you were at. You will soon have confidence with this API and be able to help others.

In your browser when you go to install.php?shop=yourshop.com it will take you to a page and if it errors copy that url. inspect it for the redirect_url parameter. what does it say?

try this

in install.php comment out this line echo "";

by adding // in front //echo "";

and echo the $install_url var echo $install_url;

ghost commented 9 years ago

I really appreciate the help. I get this http://mati-and-the-bug.myshopify.com/admin/api/auth?api_key=83b26275bdae223d467e31d3027e9b64

not worried about hiding it right now haha.

I did notice that the redirect_uri wasnt there so I add $redirect = '&redirect_uri="http://tylernichol.com/oauth"'; and then tagged that at the end. I now get

http://tylernichol.com/oauth.php?hmac=89b94af93e07392beb708f4e8f1b75a7f2afe0b0860db38c98fd3c9ebe01cba3&shop=mati-and-the-bug.myshopify.com&signature=6ee9c9b7134e0e7fdb37e6ec2aa37492&timestamp=1443727913 as the url.

but it is a blank page. I added it on the oauth.php for the permission url @myjanky

myjanky commented 9 years ago

Can you list the settings you have for the APP in your partners dashboard? this may help. It looks like the endpoint is not HTTPS on either of those URLS. make sure your app settings match

myjanky commented 9 years ago

Also I went to tylernichol.com and your cert is not setup correctly.

you get this issue because the shopify Oauth mechanism sees an invalid certificate request.

Once your cert is setup correctly you should be able to get past your issues. Just go to https://tylernichol.com and see for yourself what the oauth sees.

ghost commented 9 years ago

Of all the posts I have read on this most of the redirect urls were not https here is a screenshot of my settings screen shot 2015-10-01 at 3 42 19 pm

myjanky commented 9 years ago

You usually set it up to force ssl. I know I banged my head on that one too but it does require it. On Oct 1, 2015 2:46 PM, "tynichol" notifications@github.com wrote:

Of all the posts I have read on this most of the redirect urls were not https here is a screenshot of my settings [image: screen shot 2015-10-01 at 3 42 19 pm] https://cloud.githubusercontent.com/assets/14906918/10231900/6a2192a8-6853-11e5-926a-2d0722ad69a4.png

— Reply to this email directly or view it on GitHub https://github.com/phpish/shopify_app-skeleton/issues/8#issuecomment-144827106 .

ghost commented 9 years ago

my site is on go daddy and i cant really buy it right now. so im stuck then?

myjanky commented 9 years ago

yea. you're stuck on that server. go get a free Heroku account and push your repo to there. they have ssl already.

Also enable the embedded app setting if you want it integrated into your backend shop admin.

ghost commented 9 years ago

I have heroku for some rails stuff. I guess Ill switch it. Thanks!

ghost commented 9 years ago

Ughhh so it seems I went back a step! I created the heroku php app. It's running fine. I pushed to the master and now when I go to the install page with the shop parameters, it does nothing. I have a feeling it has to do with composer. Here is my log file for the push.

remote: ! WARNING: Your 'composer.json' contains a non-'stable' setting remote: for 'minimum-stability'. This may cause the installation of remote: unstable versions of runtimes and extensions during this deploy. remote: It is recommended that you always use stability flags instead, remote: even if you have 'prefer-stable' enabled. For more information, remote: see https://getcomposer.org/doc/01-basic-usage.md#stability remote: remote: -----> Resolved 'composer.lock' requirement for PHP to version 7.0.0RC4 remote: -----> Installing system packages... remote: - PHP 7.0.0RC4 remote: - Apache 2.4.10 remote: - Nginx 1.6.0 remote: -----> Installing PHP extensions... remote: - zend-opcache (automatic; bundled) remote: -----> Installing dependencies... remote: NOTICE: Using '/composer.phar' to install dependencies. remote: Composer version 1.0-dev (edf14dab1561096c10c71c7dfd81597ff94995a7) 2015-10-01 20:12:34 remote: remote: ! WARNING: Your Composer vendor dir is part of your Git repository remote: That directory should not be under version control; only your remote: 'composer.json' and 'composer.lock' files should be added, which remote: will let Composer handle installation of dependencies on deploy. remote: To suppress this notice, first remove the folder from your index remote: by running 'git rm --cached vendor/'. remote: Next, edit your project's '.gitignore' file and add the folder remote: '/vendor/' to the list. remote: For more info, refer to the Composer FAQ: http://bit.ly/1rlCSZU remote: remote: Loading composer repositories with package information remote: Installing dependencies from lock file remote: Nothing to install or update remote: Generating optimized autoload files remote: -----> Preparing runtime environment... remote: NOTICE: No Procfile, using 'web: vendor/bin/heroku-php-apache2'. remote: -----> Discovering process types remote: Procfile declares types -> web remote: remote: -----> Compressing... done, 81.4MB remote: -----> Launching... done, v6 remote:

Any clues @myjanky

myjanky commented 9 years ago

I do not think so. I have a few instances of Heroku using PHP and none of them are using Composer. The only dependency needed for them is PHP.

Is it just a white screen?

You should probably use the Rails shopify api as it has better tutorials and a larger community to support it. Also, check out OhShopify here on github. It is lite and more simple. Not trying to push anyone away from phpish but a firm understanding of oauth is needed to be able to diagnose any issues. I always place simple echo or print_r to dump output to the screen where I think the issue is occurring.

https://docs.shopify.com/api/authentication/oauth

It looks like you were getting to step 3 before. Are you storing the token in the session or a DB? If it is a session only then the redirect could be causing your app server to GC the session.

myjanky commented 9 years ago

If you are working on a tshirt designer, I have one. ;)

ghost commented 9 years ago

haha thats funny you mention that, I am not. I would like to have one cause our sister company has one and kills it with it. I am new to rails so I was reluctant to start that way, but I guess there is no better way to learn right? Thanks!

myjanky commented 9 years ago

I just stumbled across getonfleek from your image of your desktop.

My partner is interested in the adult onesies. He is gonna contact y'all at some point.

ghost commented 9 years ago

sweet!

sunboy88 commented 8 years ago

@myjanky : I tried change http to https on Callback URL at Shopify partner manage app but it redirected to: https://bestecommerce-2.myshopify.com/admin/oauth/authorize?client_id=&redirect_uri= and show error: Oauth error invalid_request: The redirect_uri is missing or not whitelisted I'm using PHP API. Could you please help me on this ? I tried many ways...

myjanky commented 8 years ago

Yea I can help.

Inspect your URL. The query parameters are missing for client_id and redirect_url.

I am not sure what you need the client_id for (maybe the store).

Let me know how I can assist.

On Thu, Dec 24, 2015 at 4:40 AM, sunboy88 notifications@github.com wrote:

@myjanky https://github.com/myjanky : I tried change http to https on Callback URL at Shopify partner manage app but it redirected to: https://bestecommerce-2.myshopify.com/admin/oauth/authorize?client_id=&redirect_uri= and show error: Oauth error invalid_request: The redirect_uri is missing or not whitelisted I'm using PHP API. Could you please help me on this ? I tried many ways...

— Reply to this email directly or view it on GitHub https://github.com/phpish/shopify_app-skeleton/issues/8#issuecomment-167088171 .