Skip to content

Getting Notice #25

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

Open
reachtokish opened this issue Sep 24, 2016 · 21 comments
Open

Getting Notice #25

reachtokish opened this issue Sep 24, 2016 · 21 comments

Comments

@reachtokish
Copy link

reachtokish commented Sep 24, 2016

Undefined index: signature in C:\xampp\htdocs\php-shop-app\new_prj\vendor\phpish\shopify\shopify.php on line 14

@reachtokish reachtokish changed the title Getting issue Notice: Undefined index: signature in C:\xampp\htdocs\php-shop-app\new_prj\vendor\phpish\shopify\shopify.php on line 14 Getting Notice Sep 24, 2016
@myjanky
Copy link

myjanky commented Sep 24, 2016

Need more info. Can you post your apache error logs?

@reachtokish
Copy link
Author

reachtokish commented Sep 26, 2016

Getting exactly the following issues

@myjanky
Copy link

myjanky commented Sep 26, 2016

you can not use localhost...

Also, Never post screenshots like this. I have your hmac and other personal tidbits are displayed for all to see.

@reachtokish
Copy link
Author

ok thanks for your kind information.

I will use heroku . let see if the problem will solved

Thanks

@myjanky

@reachtokish
Copy link
Author

Now I'm using heroku and getting an error

Invalid Request! Request or redirect did not come from Shopify

Don't know what to do. can you pls tell me what is going wrong here

Thanks

@myjanky
Copy link

myjanky commented Sep 27, 2016

What scopes are you using and what are you trying to do? @reachtokish I can not help with these error messages as they are the generic ones the app_skeleton displays.

The best thing to do is to read and understand how each part works down to its basics. The first thing I would do is understand Oauth. many issues can be solved once you have Oauth working and understand how it works.

https://aaronparecki.com/2012/07/29/2/oauth2-simplified

@reachtokish
Copy link
Author

Hi thanks for your quick reply. Basically I'm a shopify developer and I want to develop a shopify app by PHP as I don't know Ruby on Rails. So want to develop a Shopify app

Thanks

@myjanky
Copy link

myjanky commented Sep 27, 2016

Again, I can not help you with out having more details of the error. Invalid request could be caused by a number of things.

@reachtokish
Copy link
Author

reachtokish commented Sep 28, 2016

Hi, Thanks @myjanky for your quick response

I have checked some other issues but can't find a solution. Getting error saying 'Invalid Request! Request or redirect did not come from Shopify' which I have post before

This is my developer dashboard screenshot

fireshot capture 3 - edit app settings for myapp - shopify _ - https___app shopify com_services_pa

This is my error which I'm getting

fireshot capture 4 - - https___main-shop-app herokuapp com_oauth php_hmac 0b164d58c70725dc40c81b

This is my oauth.php code

    session_start();

    require __DIR__.'/vendor/autoload.php';
    use phpish\shopify;

    require __DIR__.'/conf.php';

    # Guard: http://docs.shopify.com/api/authentication/oauth#verification
    shopify\is_valid_request($_GET, SHOPIFY_APP_SHARED_SECRET) or die('Invalid Request! Request or redirect did not come from Shopify');


    # Step 2: http://docs.shopify.com/api/authentication/oauth#asking-for-permission
    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'));
        die("<script> 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'];

        echo 'App Successfully Installed!';
    }
    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());
    }

This is my conf.php code

    define('SHOPIFY_APP_API_KEY', '65394bcb4a6a92f4f8c5220a8e5b7295');
    define('SHOPIFY_APP_SHARED_SECRET', '809b15cd52b228da3f251b581706209b');

This is my install.php code

    # install.php?shop=example-shop.myshopify.com

    require __DIR__.'/vendor/autoload.php';
    use phpish\shopify;

    require __DIR__.'/conf.php';

    # Guard
    isset($_GET['shop']) or die ('Query parameter "shop" missing.');
    preg_match('/^[a-zA-Z0-9\-]+.myshopify.com$/', $_GET['shop']) or die('Invalid myshopify.com store URL.');

    $install_url = shopify\install_url($_GET['shop'], SHOPIFY_APP_API_KEY);
    echo "<script> top.location.href='$install_url'</script>";

This is my app url
https://apps.shopify.com/myapp-8

Please help me I'm stuck for this issue

Thanks

@myjanky
Copy link

myjanky commented Sep 28, 2016

look #22 and add your redirect url to your conf.php as REDIRECT_URL then use that var to fix the $permision_url as described here.

#22

@reachtokish
Copy link
Author

Hi, Thanks for your kind information. Basically I had read this #22 issue before. I was not very much sure about that issue. I will definitely follow your suggestion. Btw can you pls tell me settings of my development dashboard is ok or not?

Thanks @myjanky

@myjanky
Copy link

myjanky commented Sep 28, 2016

settings look ok.

@reachtokish
Copy link
Author

Thanks @myjanky

@reachtokish
Copy link
Author

@myjanky are you god or something else like that. App install successfully. I'm just excited. Finding this solution for a month. Really I'm very much thankfull to you for your kind information and helping me

Thanks a lot @myjanky

One thing can you tell me that now after installation or clicking on my app from dashboard the app is redirecting me to heroku URL . So I want the app to my Shopify dashboard like other apps. Is this possible?

Thanks @myjanky

@myjanky
Copy link

myjanky commented Sep 28, 2016

Yes,
check this out for a theme and some back end logic http://seaff.microapps.com/
then copy the contents from the url below into app file (aka get_products.php).
https://help.shopify.com/api/sdks/embedded-app-sdk/initialization

has a forceRedirect boolean to get you where you need to be.

@reachtokish
Copy link
Author

OK let me check

Thanks @myjanky

@reachtokish
Copy link
Author

Yes it works for me

Thanks a lot @myjanky :)

@myjanky
Copy link

myjanky commented Sep 28, 2016

That is great. You're welcome!

@reachtokish
Copy link
Author

Hi @myjanky Thanks for your previous help

Can you pls tell me that how can I run shopify on my local machine? That means I dont need to open shopify dashboard.

Basically I told you that I am a shopify liquid template developer and almost every time I have to work with css, HTML, jquery like stuffs and every time I have to open dahboard editor and edit my theme css, HTML. Is there any way that I can do all shopify in my local machine and after doing all the work then I can upload the theme to the shopify dashboard. Is it possible?

I know there is a way using theme kit of shopify but not so much sure that this will work or not.

This question is not related to this repo but I really want to know this

Please help me with this

Thanks

@myjanky
Copy link

myjanky commented Sep 30, 2016

I use beanstalkapp.com for version management. It lets you use GIT to push changes to beanstalkapp and then you can deploy using the apps settings. Now, you would not be able to run shopify locally but at least edit the files offline locally in your own editor (or in beanstalkapp editor).

If you use beanstalkapp then any edits in the shopify editor would not be saved in beanstalkapp. (one way pull).

@reachtokish
Copy link
Author

Thanks a lot @myjanky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants