Skip to content

Can't Get Token after Upgrade to 2.0.4 Rest #4016

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

Closed
ghost opened this issue Apr 5, 2016 · 13 comments
Closed

Can't Get Token after Upgrade to 2.0.4 Rest #4016

ghost opened this issue Apr 5, 2016 · 13 comments
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update

Comments

@ghost
Copy link

ghost commented Apr 5, 2016

Steps to reproduce

  1. Install Magento from release.

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition /var/www/domain/magento/

  1. from terminal enter ...

curl -X POST "http://domain.com/magento/index.php/rest/V1/integration/admin/token" \
-H "Content-Type:application/json" -d '{"username":"admin", "password":"admin123"}'

Expected result

"6kv3mxw10oxrcaqkkq956t23xhybk90q" or similar

Actual result

  1. Magento 2.0.2 ... result as expected
  2. Magento 2.0.4 ... (after either upgrade of 2.0.2 or new install)
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /magento/index.php/rest/V1/integration/admin/token was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
@ghost ghost changed the title Can't Get Token after Upgrade to 2.0.4 Can't Get Token after Upgrade to 2.0.4 Rest Apr 5, 2016
@mazhalai
Copy link
Contributor

mazhalai commented Apr 5, 2016

@ircsome after composer create-project, can you verify that you installed Magento2?

@ghost
Copy link
Author

ghost commented Apr 5, 2016

Yes ...

@mazhalai here are the rest of the installation steps I took after composer create-project ....

cd /var/www/domain/magento
sudo chown -R domain:www-data .
sudo find . -type d -exec chmod 770 {} \; && find . -type f -exec chmod 660 {} \; && chmod u+x bin/magento

# made a database in phpMyAdmin 

export PATH=$PATH:/var/www/domain/magento/bin
echo '# set PATH so it includes magento bin at login
if [ -d "/var/www/domain/magento/bin" ] ; then
 PATH="$PATH:/var/www/domain/magento/bin"
fi' | sudo tee -a ~/.profile

# install magento
magento setup:install --base-url=http://domain.com/magento/ \
--db-host=localhost --db-name=magento --db-user=root --db-password=domain \
--admin-firstname=Neil --admin-lastname=Edmondson [email protected] \
--admin-user=admin --admin-password=admin123 --language=en_US \
--currency=USD --timezone=America/Chicago --cleanup-database --session-save=files --use-rewrites=1

# resulted in
# [SUCCESS]: Magento installation complete.
# [SUCCESS]: Magento Admin URI: /admin_pc6055

@mazhalai
Copy link
Contributor

mazhalai commented Apr 6, 2016

@ircsome so to recap, you deployed via composer create-project, installed Magneto2, and then attempted to curl details from an integration? Did you follow steps to create and configure an integration?

@ghost
Copy link
Author

ghost commented Apr 6, 2016

Did you follow steps to create and configure an integration?

@mazhalai - yes. I am using Token Based Authentication as suggested in these instructions.

I am developing a php module to access product data via the rest api (see attached for a couple of functions from this).

My primary use of curl from the terminal is to test if the api interface is working before I code the php.

I have tried to a) update the existing 2.0.2 install to 2.0.4 and re-test, b) install a completely new 2.0.4 and test.

My testing works fine with 2.0.2 - and I get the results returned that I expect. But I get the errors described in the original report with either install of 2.0.4.

restapi.txt

@mazhalai
Copy link
Contributor

@ircsome we have created MAGETWO-51785 to investigate and fix.

@mazhalai mazhalai added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed Progress: needs update labels Apr 11, 2016
@ghost
Copy link
Author

ghost commented Apr 11, 2016

@mazhalai thanks! how do I track the progress of MAGETWO-51785?

@mazhalai
Copy link
Contributor

@ircsome Sorry that is our internal tracking, it is not available for the public. Once a solution is merged, the commits will be linked to this ticket.

@arkadiych
Copy link
Contributor

@ircsome, could you answer some questions:

  • does it work for you if "--base-url=http://domain.com/" for 2.0.2 and 2.0.4
  • when you get 404 via REST request, could you open home and admin pages?

@ghost
Copy link
Author

ghost commented Apr 25, 2016

@arkadiych

  • does it work for you if "--base-url=http://domain.com/" for 2.0.2? YES
  • does it work for you if "--base-url=http://domain.com/" for 2.0.4? NO
  • when you get 404 via REST request, could you open home and admin pages? YES

see attached images for illustration ...
gettoken
adminpage-stotty
adminpage

@arkadiych
Copy link
Contributor

@ircsome, if you update a magento instance on clarts.com to 2.0.4, does it work or not?
I have installed magento 2.0.4 from composer and was able to get the expected result.
Could you also check web server settings?
Any additional information, that can help to reproduce the issue, would be also appreciated.

@ghost
Copy link
Author

ghost commented Apr 28, 2016

@arkadiych

When I first reported the error I was getting 404s whether I tried against a new install of 2.0.4 or an upgrade of 2.0.2 to 2.0.4.

I have just done a clean install of 2.0.4 using the attached script. I no longer get a 404 ... but now I don't get anything returned. Has the repo changed in he intervening period? (NOTE: just noticed the repo has been updated to 2.0.5 which may account for the different result).

token.txt

@arkadiych
Copy link
Contributor

@ircsome , I've installed Magento 2.0.5 from composer. I verified for php 5.6 and php 7. In both cases it works as expected.
I'd recommend you to check permissions. Try also to debug the code.

@mazhalai
Copy link
Contributor

@ircsome we are closing this bug, since it is not reproducible after repeated tries. Please feel free to open a new issue if problems exist.

magento-engcom-team pushed a commit that referenced this issue Apr 6, 2019
…ion-pr

[Pangolin] Deliver community converted Captcha tests 

 - closes magento-commerce/magento-functional-tests-migration#248 Convert CaptchaEditCustomerTest to MFTF
 - closes magento-commerce/magento-functional-tests-migration#244 Convert CaptchaOnStoreFrontRegisterTest to MFTF
 - closes magento-commerce/magento-functional-tests-migration#245 Convert CaptchaOnStoreFrontLoginTest to MFTF
 - closes magento-commerce/magento-functional-tests-migration#275 Convert CaptchaOnContactUsTest to MFTF
 - closes magento-commerce/magento-functional-tests-migration#247 Convert CaptchaOnAdminLoginTest to MFTF
 - closes magento-commerce/magento-functional-tests-migration#379 Convert ResetCustomerPasswordFailedTest to MFTF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update
Projects
None yet
Development

No branches or pull requests

3 participants