Login

This API is for login to user account


GRAPHQL


Headers

FieldsTypeDescriptionExampleData Management
URLstring{base_url}/users
GRAPHQLstringQUERY
content-typestringJSONapplication/json

Request

{
  login_with_otp(email: "johndoe@gmail.com", otp: "12345") {
    token
  }
}

Request Parameters

FieldsTypeDescriptionRequired
emailstringemail of the user
otpstringOTP received on the registered email

Success

{
    "data": {
        "login_with_otp": {
            "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4iLCJhY2NvdW50VHlwZSI6ImFkbWluIiwiaWF0IjoxNjUyMzI4MjAyLCJleHAiOjE2NTIzNDk4MDJ9.qPBFexWB-bYK3P5o9SvoJIiUABnJJ80baKqfw8Uj6Hw"
        }
    }
}

Error

{
    "errors": [
        {
            "message": "Email not registered",
            "locations": [
                {
                    "line": 2,
                    "column": 3
                }
            ],
            "path": ["login_with_otp"]
        }
    ],
    "data": {
        "login_with_otp": null
    }
}


{
    "errors": [
        {
            "message": "Incorrect OTP",
            "locations": [
                {
                    "line": 2,
                    "column": 3
                }
            ],
            "path": ["login_with_otp"]
        }
    ],
    "data": {
        "login_with_otp": null
    }
}