Skip to content
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

Connection to API - different admin path URL not working #81

Closed
silcky opened this issue Jul 9, 2015 · 9 comments

Comments

@silcky
Copy link

commented Jul 9, 2015

Because of security reasons we have changed the default admin path for the backend (URL) within our local.xml.
I noticed that it is not possible to connect the API from Zendesk to Magento when this is not '.../admin'.

image 2015-07-09 at 10 58 24 vorm

I found an entry within the file '/app/code/community/Zendesk/Zendesk/conrollers/ApiController.php'
image 2015-07-09 at 10 54 45 vorm

I've been trying to make some changes but this isn't working.

However, when I use the default settings it's able to connect:

image 2015-07-09 at 11 00 10 vorm

Any ideas? Thank you

@knockawes

This comment has been minimized.

Copy link

commented Aug 6, 2015

Having the same issue.

@jwswj

This comment has been minimized.

Copy link
Member

commented Aug 7, 2015

You could manually customize the code to get this working for now. Does anyone have examples of how this should be handled for Magento plugins? If you could share them with us it would be great. Even better submit a pull request with the changes.

@markjw

This comment has been minimized.

Copy link

commented Aug 8, 2015

Also have this same issue

@silcky

This comment has been minimized.

Copy link
Author

commented Aug 8, 2015

I don't know which lines to change but make sure that you don't overwrite the core files of the plugin.
So, just copy the necessary file from ../app/code/community/Zendesk/... to ../app/code/local/Zendesk/...

Otherwise your changes are gone after an update of the extension. Any further ideas how to fix/improve that?

@mshaw42

This comment has been minimized.

Copy link

commented Aug 17, 2015

I have had this problem by just using store codes in urls.

I don't believe that the Zendesk people have any idea about how to get their software to work with Magento in 'common use cases'.

I decided to 'fix' this by picking up 404 'no-route' errors in Magento and then re-routing them to the correct url, i.e. by swapping 'index.php' in the url for 'en_us' (yes 'en_us' is the store code for my US store front.).

This I put in my custom module:

        if(strpos($current, 'index.php/zendesk/api')!==false) {

            $redirect = str_replace('index.php', 'en_us', Mage::helper('core/url')->getCurrentUrl()); // Need query string
            Mage::app()->getResponse()->setRedirect($redirect, 302)->sendResponse();
            Mage::log("Redirecting Lame^H^H^H^HZendesk request from ".Mage::helper('core/url')->getCurrentUrl()." to ".$redirect);
            exit(0);

        }

If Zendesk wasn't locked in to numerical id's for things then I would write this more neatly so as to get the first store code and use that in the URL. Obviously my solution will break at the first chance, i.e. if the store codes get changed.

@silcky

This comment has been minimized.

Copy link
Author

commented Aug 24, 2015

This is a store code problem... for sure. It works when I disable them and obviously it also works with a custom admin path. Where did you make these changes? Any other ideas how to fix that?
Additional note:
I found this:
https://github.com/zendesk/magento_app/pull/33

It seems they already know the problem but it doesn't work with the current Magento zendesk app.

@silcky

This comment has been minimized.

Copy link
Author

commented Aug 24, 2015

Ok I have fixed the problem. Thanx to @jwswj
Just include this modification and create a custom app within Zendesk.
https://github.com/zendesk/magento_app/pull/33

There you will see a new textfield for the store code. Take the main code and it works.
Test:

curl -X GET -H 'Authorization: Token token="123your0token456"' http://yourdomain.com/index.php/yourstorecode/zendesk/api/customers/customer@domain.com
@silcky silcky closed this Aug 24, 2015
@jwswj

This comment has been minimized.

Copy link
Member

commented Aug 24, 2015

@grindking good to see you got your solution working, but I don't think it fully gets to the bottom of the issues described in this thread:

  • Testing a connection to the API doesn't work with a different admin URL
  • The integration out of the box doesn't admin url
    If anyone else comes across these please add a comment here or open a new issue so we can understand the exact use-cases.

@mshaw42 we aren't Magento experts which is why we had this extension built by Magento contactors in the past, we've now got an internal team who is coming up to speed and starting to learn the best practices to continue to evolve this integration and plus many others that we have.

@grindking & @mshaw42 Thanks for providing work-arounds for now.

@silcky

This comment has been minimized.

Copy link
Author

commented Aug 24, 2015

@jwswj
Yes that is true, it's not a 100% solution. The testing is not working with another URL and the current app from Zendesk does not include the store-code field. I hope there will be an update soon.
Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.