Skip to main content

customerLogin

Overview

Initiate customer login using CustomerLoginInput. Depending on your backend, this may trigger OTP flows, login links, or return a token immediately.

  • Type: GraphQL Mutation
  • Endpoint: https://subdomain.com
  • Authentication: none required (public login entry point)

Mutation

mutation CustomerLogin($input: CustomerLoginInput!) {
customerLogin(input: $input) {
success
message
token
data
}
}

Variables

{
"input": {
"identifier": "user@example.com",
"type": "email",
"country": "SA"
}
}

identifier could be email/phone depending on type. Include country if the backend uses it for phone codes or locale.

Examples

curl -X POST \
https://subdomain.com\
-H "Content-Type": "application/json" \
--data-binary @- << 'EOF'
{
"query": "mutation CustomerLogin($input: CustomerLoginInput!) { customerLogin(input: $input) { success message token data } }",
"variables": {
"input": {
"identifier": "user@example.com",
"type": "email",
"country": "SA"
}
}
}
EOF

Notes

  • If the API sends OTP codes, token might be null until the OTP verification mutation is called.
  • data can contain extra metadata (e.g., whether the user exists); inspect it per your backend contract.
  • Securely store any returned token (e.g., in HTTP-only cookies) for subsequent authenticated calls.