Issue logging in customers using GraphQL

Highlighted
New Member
2 0 2

I'm having trouble authenticating customers, and receiving the access token using Shopify's Admin GraphQL endpoint. I followed the example on the documentation (https://shopify.dev/docs/storefront-api/reference/mutation/customeraccesstokencreate?api[version]=20...). This is the error I'm getting:

{
    "errors": [
        {
            "message": "CustomerAccessTokenCreateInput isn't a defined input type (on $input)",
            "locations": [
                {
                    "line": 2,
                    "column": 40
                }
            ],
            "path": [
                "mutation customerAccessTokenCreate"
            ],
            "extensions": {
                "code": "variableRequiresValidType",
                "typeName": "CustomerAccessTokenCreateInput",
                "variableName": "input"
            }
        },
        {
            "message": "Field 'customerAccessTokenCreate' doesn't exist on type 'Mutation'",
            "locations": [
                {
                    "line": 3,
                    "column": 7
                }
            ],
            "path": [
                "mutation customerAccessTokenCreate",
                "customerAccessTokenCreate"
            ],
            "extensions": {
                "code": "undefinedField",
                "typeName": "Mutation",
                "fieldName": "customerAccessTokenCreate"
            }
        },
        {
            "message": "Variable $input is declared by customerAccessTokenCreate but not used",
            "locations": [
                {
                    "line": 2,
                    "column": 5
                }
            ],
            "path": [
                "mutation customerAccessTokenCreate"
            ],
            "extensions": {
                "code": "variableNotUsed",
                "variableName": "input"
            }
        }
    ]
}

Any ideas?

0 Likes
Highlighted
New Member
2 0 2

Fixed the issue. Turns out I was using the wrong API. I needed to use the StoreFront API instead of the Admin API

2 Likes