phpish / shopify_app-skeleton

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

Bad Request in oauth #31

Open tracysailors opened 7 years ago

tracysailors commented 7 years ago

Hello, I'm receiving the following error in oauth.php. The install and app is working, but kicking back the following.

Any help is greatly appreciated! Thanks!

phpish\shopify\ApiException: [400] Bad Request (https://XXXXXXXX.myshopify.com/admin/oauth/access_token) in /nfs/c12/h04/mnt/220759/domains/XXXXXXXX/oauth.php on line 28 Array ( [method] => POST [uri] => https://XXXXXXXX.myshopify.com/admin/oauth/access_token [query] => Array ( ) [headers] => Array ( ) [payload] => Array ( [client_id] => XXXXX [client_secret] => XXXXX [code] => XXXXX ) )

myjanky commented 7 years ago

Hi @tracysailors When does the error happen? After install and when redirecting to the app nuts and bolts?

tracysailors commented 7 years ago

Thanks for the reply! Yes, install works fine. The error occurs when reloading "oauth.php". I have my app URL set to point to "oauth.php", so anytime you load the app from Shopify.

myjanky commented 7 years ago

I see. You may have a redirect back to oauth.php then you can either store a permanent token exchanged for the temp one then do a header("location: ......") type of redirect to the nuts and bolts around line 31 of oauth.php. where the echo 'app installed successfully'

I use the ohshopify php lib due to this one having not been updated in awhile. You may have better luck with that. This one has an HMAC issue I think.

tracysailors commented 7 years ago

I changed to do a redirect with header() for now. Thanks!

raviravikant commented 7 years ago

Hi , I have set a redirect url in oauth.php link below:- $publicappredirect_Url = 'http://payflic.flexsin.org/oauth.php'; if (!isset($_GET['code'])) { $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'), $publicappredirect_Url); die(""); } and i have successfully installed the app in my development store , but when i click on my app it will redirect me on my site or give me an error like below , phpish\shopify\ApiException: [400] Bad Request (https://XXXXXXXX.myshopify.com/admin/oauth/access_token) in /nfs/c12/h04/mnt/220759/domains/XXXXXXXX/oauth.php on line 28 Array ( [method] => POST [uri] => https://XXXXXXXX.myshopify.com/admin/oauth/access_token [query] => Array ( ) [headers] => Array ( ) [payload] => Array ( [client_id] => XXXXX [client_secret] => XXXXX [code] => XXXXX ) )

can you guys please help me, I am new in shopify app development

myjanky commented 6 years ago

looks like there is no access token being passed. Any more details to this.