OTP Status and Validation
2 min
- In order to send otpValid request, otpStatus must be called first.
- otpStatus method returns true, otpValid should be sent. otpStatus asks whether otp is active or inactive for the user, if otp is active this method generate valid OTP value then returned true response
otpStatus
otpStatus
POST
https://{{hostname}}/twofactorauth-ui/rest/tfa/otpStatus
var client = new RestClient("https://{{hostname}}/twofactorauth-ui/rest/tfa/otpStatus");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Cookie", "NETRIGHT_SESSIONID=8f118fa5-1d0a-433e-97b3-56dfec482b22; XSRF-TOKEN=314cf821ce6395572ecd5ce8858bad3a");
request.AddParameter("username", "batuhan.tests");
request.AddParameter("endUserIp", "1.2.3.4");
request.AddParameter("applicationName", "BatuhanBilginDeneme");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
otpValid
otpValid
POST
https://{{hostname}}/twofactorauth-ui/rest/tfa/otpValid
var client = new RestClient("https://{{hostname}}/twofactorauth-ui/rest/tfa/otpValid");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Cookie", "NETRIGHT_SESSIONID=8f118fa5-1d0a-433e-97b3-56dfec482b22; XSRF-TOKEN=314cf821ce6395572ecd5ce8858bad3a");
request.AddParameter("username", "batuhan.test");
request.AddParameter("token", "489375");
request.AddParameter("applicationName", "BatuhanBilginDeneme");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);