2
votes

I'm trying to use the php shopify api library created by cmcdonaldca at https://github.com/cmcdonaldca/ohShopify.php and

I am getting this error:

The redirect_uri and application url must have matching hosts

This occurs after I type in the shop name of [myshopname].myshopify.com and the error appears on a page with this url: https://[myshopname].myshopify.com/admin/oauth/authorize?client_id=[myclientid]&scope=Customer&redirect_uri=http%3A%2F%2Flocalhost%2Ftest%2FshopifyAPITest2.php

I'm doing this development locally so my host is localhost, is that really the issue? The first time I tried entering a shop name I got to the shopify page asking me to login, but then when I tried it again later it is giving me the error. Is there some session variable that was set initially that is causing the error? It doesn't look like it based on the error, but that's what the behavior suggests.

Please help me understand how to address this issue. If it really means the api script needs to be hosted at myshopify.com (the host for [myshopname].myshopify.com) how would I put a php script there?

Thank you

2

2 Answers

5
votes

The error you're receiving is telling you that the domain of the application URL you entered for the app in the Partners dashboard differs from the one you're providing with your OAuth request.

Make sure it's listed as localhost and the error should go away.

App preferences screenshot

2
votes

Also, make sure you have set your API key and shared secret correctly in config/application.rb