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

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/… Sep 25 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 Sep 26 at 16:28

Your Answer

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

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