0

I have a multi site Magento installation we do not share login per website. We have 2 websites under the same domain each with separate store views.

If you create and account on the second store view I'm enabled to via graphql login customer using generateCustomerToken. Am I missing something this doesn't work?

mutation generateCustomerToken($email: String!, $password: String!) {
      generateCustomerToken(email: $email, password: $password) {
      token
  }
}

Error:

{
    "errors": [
        {
            "message": "The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.",
            "locations": [
                {
                    "line": 2,
                    "column": 7
                }
            ],
            "path": [
                "generateCustomerToken"
            ],
            "extensions": {
                "category": "graphql-authentication"
            }
        }
    ],
    "data": {
        "generateCustomerToken": null
    }
}

However I can login fine via the website store view url.

3
  • Hi, which version of Magento 2 you are using? You might be looking for [link ] (github.com/magento/magento2/issues/35084) and one PR was raised against this issue [link] (github.com/magento/magento2/commit/…). If it is the same issue then you can create a custom patch from the PR and apply it. Commented Sep 25, 2023 at 10:06
  • I just checked the fix is available in v2.4.6-p2 Commented Sep 25, 2023 at 10:13
  • 1
    just a quick question. Are you passing the store code in the header? If not then it could be the possible reason for this issue. Commented Sep 25, 2023 at 10:23

1 Answer 1

1

Yes, you have to create customer tokens for different stores on the website.

First, you need to add a store in the header and create a token for the customer. So every customer token is created by the current store in the header. If you did not add a store in your header then it's take default store.

For Add Store in header please check this link : https://magento.stackexchange.com/a/326128/82670

enter image description here

2
  • ahhh ok I need to add the header 'Store' Thanks, I found the docs where this is mentioned : devdocs.magento.com/guides/v2.3/graphql/… But not here developer.adobe.com/commerce/webapi/graphql/schema/customer/… Commented Sep 25, 2023 at 11:04
  • However it works, there seems to be an issue when switching between store sometimes I get The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later. After waiting like 30min or so I requested again and it worked, I'm using postman for testing and I could login with the same credentials via the frontend but Graphql seem to have some issue. I'll got this issue couple of times where I had to wait, I'll try and replicate to see If I can find what's causing it Commented Sep 26, 2023 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.