Open reivax opened 9 years ago
never mind I figured it out: the redirect URL in oauth.php is missing the redirect param which is necessary now I suppose. on line 18: $permission_url = $permission_url . '&redirect_uri=YOUR_REDIRECT_URL'
add an entry in conf.php that has the redirect url from the app you created on shopify and you should be ready to go...
Im stuck on this in my browser with a blank screen
you got past that. Any clues?
@tynichol what is your redirect uri set to in the partners dashboard
Also it looks like you still have the blank index.html file in the project. That is the file that you need to customize for your app. either you are not redirecting to the correct uri or you are and it is pointed at index.html. which is a blank page.
hey @myjanky long time. I started a ruby app but dont have time for the learning curve. my redirect is https://quiet-basin-5290.herokuapp.com/oauth.php
I think something is wrong with composer as well. Im getting this when I push to heroku:
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
@tynichol https://quiet-basin-5290.herokuapp.com/oauth.php Should be your callback url (or Application URL(required) when viewing from edit settings).
Your redirect could be any one of the examples given in the repo, such as create_product.php, get_products.php and get_shop.php. But if you have the redirect uri in the settings set to https://quiet-basin-5290.herokuapp.com/oauth.php then it is just gonna take you to the oauth page which it has already completed authorization. Shopify gets confused because it is not getting the correct parameters for Step 2: http://docs.shopify.com/api/authentication/oauth#asking-for-permission Make sure you change line 18: $permission_url = $permission_url . '&redirect_uri=YOUR_REDIRECT_URL' as suggested above as well. You can save the variable in conf.php to make them global if you decide to add more redirects.
As for your second issue, I think if you are uploading the composer files to heroku it can get confused. If you have locally cloned all the dependencies such as phpish/shopify than you should be fine. Just delete the composer files and let heroku build run blind.
All works now! Thanks @myjanky you are a patient man!
Not a problem. Let me know if you are having further issues. Glad to help.
FWIW, I have used all the shopify API libs out there and have even custom made my own. It just really depends on what you are after and for me what the other devs I work with are comfortable using. This one is pretty good as it is proper OOP, lightweight and the coding convention is superb. The only thing it lacks at this level is session management but if you are only gonna install the app in one store than you can do away with sessions and have it all DB driven.
@myjanky Well crap now that I changed it to get_products its not working.
call back = https://shielded-inlet-9096.herokuapp.com/oauth.php redirect = https://shielded-inlet-9096.herokuapp.com/get_products.php line 18 in oauth = $permission_url = $permission_url . '&redirect_uri=https://sheilded-inlet-9096.herokuapp.com/get_products.php';
getting the oauth error again
what the f david blaine
I get this error when going to your redirect.
GET [uri] => https:/admin/products.json
Thats because you are skipping auth. When you go to https://shielded-inlet-9096.herokuapp.com/install.php?shop=getonfleek.myshopify.com it get's token but then it wont clear the redirect
I am using my shop to test your app so I get a token. It errors out due to redirect_uri is missing or not whitelisted. We know it is there in the URL but I can not check your settings in the back end. Something has changed. were you able to get to the install application page that auths the app? If so you should be able to use that token for get_products.php
Like the instructions say I go to https://shielded-inlet-9096.herokuapp.com/install.php?shop=getonfleek.myshopify.com
then it automatically takes me to the redirect get_products where I get the error
Here are my settings
I am working on a heroku instance I am going to share with you. I noticed you also have an unanswered issue in ohShopify
ya I was trying that interface as well. It seems to have a lot of deprecated issues and no support
what i noticed with heroku is I didnt build the composer file, I let heroku do that on push. Then it gets past the 500 error
OK looks like line 15 of install.php is not returning https
change this: echo "script> top.location.href='$install_url'/script>"; to this: echo $install_url;
to debug the script. You will see the output and can copy the address and use HTTPS instead. go here after entering your shop http://tynichol.herokuapp.com/install.php?shop= and you will see the url with http instead of https
The bug is on line 9 of the phpish/shopify.php you may need to load the dependencies without composer to be able to change the code in that file. Also if you need to remove the vendor folder to allow heroku to build just run git rm -r --cached vendor/
cant I append it in install.php when if I change shopify.php and let heroku run without vendor it will build the original version of shopify.php without the changes
Its hard coded in shopify.php return "http://$shop/admin/api/auth?api_key=$api_key";
You could override the function within install.php
$url = str_replace( 'http://', 'https://', $install_url ); echo "";
trying this now
That works.
Just curious as to your workflow. Do you commit changes and PUSH after every edit before testing?
yes. I just tried it. I get the https added but it is still not working
Also, mine works if you want the heroku app I can give it to you
Sure! I really am frustrated cause I don't know whats going on. How can I grab it?
Wow. Im an idiot. there is a difference between shielded and sheilded. I had it misspelled in my oauth.php
i need your email addy if you want the heroku build shared but I can also walk you step by step to get a working instance on your side so you will be able to sync back to heroku if needed.
Did you get it working?
App is installed successfully but get this at redirect
phpish\shopify\CurlException: [6] Could not resolve host: https in /app/get_shop.php on line 14Array ( [method] => GET [uri] => https:/admin/shop.json [query] => [headers] => Array ( [X-Shopify-Access-Token] => [content-type] => application/json; charset=utf-8 ) [payload] => ) Array ( )
get_shop.php has a problem when trying to redirect to it. I can access it after I see the App installed Successfully message from oauth.
I replaced line 31 echo 'App Successfully Installed!'; with echo "script> top.location.href=https://tynichol.herokuapp.com/get_products.php/script>";
ya i never get the app successfully installed message
after researching this, it seems to be an issue a lot of people are having
Any luck?
sorry had a management meeting with my staff.
can we move this to a iirc?
I can walk you through a clean install that works.
i'v solved this by adding redirect_uri parameter to authorization_url() method in oauth.php file (line 17):
$permission_url = shopify\authorization_url($_GET['shop'], SHOPIFY_APP_API_KEY, array('read_content', 'write_content', 'read_themes', 'write_themes', 'read_products', 'write_products', 'read_customers', 'write_customers', 'read_orders', 'write_orders', 'read_script_tags', 'write_script_tags', 'read_fulfillments', 'write_fulfillments', 'read_shipping', 'write_shipping'), 'https://dev.mydomain.com/app/oauth.php');
important: redirect_uri should be the same like in settings
Hi, How do I add an entry in oauth.php for redirect uri , that has the redirect url from the app you created on shopify.
You mean, need to add code like below like this or what else, please suggest
define('REDIRECT_URI', 'http://my-domain-namet/directory-name/index.php');
yes
Thanks a lot, will try to add it in oauth.php
Hello, I installed the app but it show me error phpish\shopify\CurlException: [7] Failed to connect to dblgaurav.myshopify.com port 443: Connection timed out in /home/dbuglndz/public_html/shopifyapp/oauth.php on line 26Array ( [method] => POST [uri] => https://dblgaurav.myshopify.com/admin/oauth/access_token [query] => Array ( ) [headers] => Array ( ) [payload] => Array ( [client_id] => 3fc246ff677ec014b4752e5d1472274f [client_secret] => e13db5c49e6f509227619c475b3d5db8 [code] => fbfd8ae374e1e05fa3f38c5b823cb319 ) ) Array ( )
during access token. Can you please help me with this.Thanks is advance
Thanks Gaurav
Hi Gaurav,
I do not think this is an issue with shopify app skeleton. It looks like the server you have your code on can not create a curl connection to your shopify store. If you have a command line you can try to ping your store and troubleshoot the connection.
Oh and it is not generally a good idea to publish your secret key and access token. But I suspect you know that.
Hi Myjanky,
Thanks for the reply. I checked the curl and its working fine. I also tried it on other server. But it return me same error. IS there any thing required to allow shopify for server access ?
I do know that Shopify recently made SSL available to the entire Store and not just the checkout portion. This could be the port error it is complaining timing out.
try using a REST client to POST to https://dblgaurav.myshopify.com/admin/oauth/access_token
Can you post a screenshot of your partners account app setup?
yes sure just a sec
http://prntscr.com/9yj0r6 This is my test trial account. You can access it via dbl.gaurav@gmail.com / asdasdasd
this is the error I get
I see the redirect_uri is missing from your code. Can you post the contents of your conf.php?
yes let me add that.
please check now. I added the redirect_uri
I seem to be getting an error now when using the SDK: Oauth error invalid_request: The redirect_uri is missing or not whitelisted
my callback URL is oauth.php as explained in the readme
anyone seeing the same thing? Saw some comments that shopify changed the handshake a couple months ago...