A simple otp micro-service built using NodeJS and GraphQL
- Clone the repo.
- npm i.
- node index.js.
- Visit localhost:4000/graphql
mutation {
createOtp(otp: {
source: "sms", // Source can be 'sms' or 'email'
contactNumber: "99999", // Contact number or email should be provided based on the source
template: "Custom template is ##OTP##" // Optional field
}) {
id
}
}
mutation {
authenticateOtp(otp: {
source: "sms",
contactNumber: "99999",
otp: "nodg3"
}) {
result
}
}
mutation {
resendOtp(otp: {
source: "email",
email: "sre@df.com"
}) {
result
}
}
query {
active {
id
otp
active
}
}
query {
all {
id
otp
active
}
}