Resend SMS OTP code
1 min
code examples curl request post \\ \ url http //localhost 10101/api/v1/auth/mfa/resend \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "challengeid" "ch abc123xyz" }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "challengeid" "ch abc123xyz" }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("http //localhost 10101/api/v1/auth/mfa/resend", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("http //localhost 10101/api/v1/auth/mfa/resend") http = net http new(url host, url port); request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "challengeid" "ch abc123xyz" }) response = http request(request) puts response read body import requests import json url = "http //localhost 10101/api/v1/auth/mfa/resend" payload = json dumps({ "challengeid" "ch abc123xyz" }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // otp resent successfully { "challengeid" "ch abc123xyz", "method" "sms", "expiresin" 300, "maskedphonenumber" " 1234" }// invalid request or not sms mfa { "error" "unauthorized", "message" "invalid username or password", "code" "unauthorized" }// challenge expired { "error" "unauthorized", "message" "invalid username or password", "code" "unauthorized" }// internal server error { "error" "unauthorized", "message" "invalid username or password", "code" "unauthorized" }