magento2 Customer unable to get token in customer/token rest api

Created on 12 Apr 2019  Â·  21Comments  Â·  Source: magento/magento2

Preconditions
Magento 2.3

Steps to reproduce
Customer is signup through rest api in magento 2.3 successfully. after signup, I am unable to get customer's token through customer/token rest api. Api returns following error:

Actual result
issue1

Although customer is successfully login through web but unable to get validate in rest api.

Expected result
token must be generated

Customer Confirmed Format is valid Ready for Work Reproduced on 2.2.x Reproduced on 2.3.x

Most helpful comment

@Shubham-Webkul thanks for pointing out the issue. There is only one parameter passed to get customer. I just passed the website_id to that method and API returns the access_token. I think there should be default website_id passed to it to get the customer which is not happening in this version.

All 21 comments

Hi @uthegenius. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@uthegenius do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

Hi @shikhamis11. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

:white_check_mark: Confirmed by @shikhamis11
Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-99167, MAGETWO-99168 were created

Issue Available: @shikhamis11, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

Hi @Shubham-Webkul. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

Hi @Shubham-Webkul. Thank you for your request. I'm working on Magento 2.3-develop instance for you

Hi @Shubham-Webkul, here is your Magento instance.
Admin access: https://i-22312-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

Hie @uthegenius,
I think there is no issue with the API. Can you please remove all store code form URL.
so URL would be: /rest/V1/integration/customer/token.
Please refer this for more information about store code all in URL: https://devdocs.magento.com/guides/v2.3/get-started/gs-web-api-request.html#endpoints

@ronak2ram
Yes it will work if all is removed from the url .. but if anyone using Magento swagger it must be correct there

Swagger also returns the same error.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Shikha Mishra notifications@github.com
Sent: Sunday, April 14, 2019 12:30:35 AM
To: magento/magento2
Cc: Usama Abdul Haque; Mention
Subject: Re: [magento/magento2] magento2 Customer unable to get token in customer/token rest api (#22312)

@ronak2ramhttps://github.com/ronak2ram
Yes it will work if all is removed from the url .. but if anyone using Magento swagger it must be correct.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/magento/magento2/issues/22312#issuecomment-482871461, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF-TzRta6XM9q835fNbk9DVMpGUDiZhWks5vgjBbgaJpZM4csfGr.

You correct @shikhamis11
I think, have an issue with swagger.

@ronak2ram & @shikhamis11
There is no issue in Swagger. This is related createCustomerAccessToken API. It should one more parameter is website_id because if you check Magento configuration -> Customer Configuration -> Share Customer Accounts is set per website . If you will get token after set is global then it will work. In this case website_id pass 0 and there is no customer exist for this website.

@Shubham-Webkul thanks for pointing out the issue. There is only one parameter passed to get customer. I just passed the website_id to that method and API returns the access_token. I think there should be default website_id passed to it to get the customer which is not happening in this version.

  • For customer token if pass all in the API url then you need to pass website_id 0

  • For customer token if you want it store wise then you need to pass store_code in the API url

    POST <host>/rest/<store_code>/V1/integration/customer/token

  • But if you haven't configure any stores then pass default

    POST <host>/rest/default/V1/integration/customer/token

And to fetch all store data using API

storeStoreRepositoryV1


Group repository interface

http://magento.host/index.php/rest/V1/store/storeGroups
  • method : GET
  • Authorization : Bearer <admin token>

This will return website_id, root_category_id, default_store_id, name, code


Hi @irajneeshgupta. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.


Not the valid issue,
If you are trying to check in swagger so please change the base url first..
To view the Swagger documentation for a specific store view, use this URL:
http:///swagger?store=
So in your case the url will be like this
http:///swagger?store=default

Now you can try to customer/token rest api, it will generate token successfully

magneto 2.3.3 not returning customer token
I am unable to get customer's token through customer/token rest api. Api returns following error:
"The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again [later."]
Screenshot from 2020-01-08 16-32-23

@magento-engcom-team give me 2.4-develop instance

Hi @irajneeshgupta. Thank you for your request. I'm working on Magento 2.4-develop instance for you

Hi @irajneeshgupta, here is your Magento instance.
Admin access: https://i-22312-2-4-develop.instances.magento-community.engineering/admin_a251
Login: bf9aeace Password: e1ffe43bff75
Instance will be terminated in up to 3 hours.

Was this page helpful?
0 / 5 - 0 ratings