Once you've started an MFA request through HyperID's API, it's essential to monitor its status. Checking the status allows your application to provide timely feedback to users and take appropriate actions based on the result of the MFA request.
To inquire about the status of an MFA request, services should send a POST request to the HyperID API, requiring the 'mfa-client' scope, which must be explicitly granted by the user during the authorization process.
The result field is an integer representation of request result, with various possible values as listed in the table below:
Result Value
Meaning
0
Success
-1
Failure because the service is temporarily unavailable
-2
Failure due to invalid request parameters
-3
Failure due to access denial
-4
Failure due to an expired token
-5
Failure due to an invalid token
-6
Failure due to a transaction with the provided ID is not found
The transaction_id is the unique identifier provided during requesting status.
The transaction_status reflects the current status of the MFA request and is represented as an integer with various possible values, as outlined in the table below:
Status Value
Meaning
0
Pending: The MFA request is still awaiting user action
1
Completed: The user has successfully completed the MFA request
2
Expired: The MFA request is expired
4
Canceled: The user has declined the MFA request
The transaction_complete_result is only meaningful when the transaction_status is 'Completed' (equals '1'). In this case, it indicates whether the user approved or denied the requested action:
Complete Result Value
Meaning
0
Approved
1
Denied
Here are examples of the 'Check MFA Request Status' implemented:
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "http://api.hypersecureid.com/mfa-client/transaction/status-get");
request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImFjZDc0NGMzLWFlZDMtNGQxMC04ODZhLTcyYjU0MGY4NmU5YSJ9.eyJleHAiOjE2Nzk4MjM1NTEsImlhdCI6MTY3OTgxOTk1MSwiYXV0aF90aW1lIjoxNjc5ODE5OTUxLCJqdGkiOiIzM2ZlNzI2Ni1kOTY2LTRlNDgtYjU2My05ZWNhZTdjMWU3NTEiLCJpc3MiOiJodHRwczovL2xvZ2luLmh5cGVyc2VjdXJlaWQuY29tL2F1dGgvcmVhbG1zL0h5cGVySUQiLCJzdWIiOiI5MTZlMGUyZS00NmQ5LTRiODAtODg1Ni1kZDlmZWRiMWI3MjMiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJjbGllbnQtc2VydmljZS1hcHAiLCJzY29wZSI6Im9wZW5pZCBlbWFpbCBrZXlzIGF1dGgiLCJzaWQiOiI5OTVjNzhhZC1lYmFjLTRhYWYtOTdiZC0xOTQ4ZWMxOWQzNzEiLCJ3YWxsZXRfYWRkcmVzcyI6IjB44oCmIiwid2FsbGV0X2NoYWluX2lkIjoiMSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJlbWFpbCI6InVzZXJAZ21haWwuY29tIn0.h9GusuxDPX8VOjPoZHD73XzktOkVtd1qEz6C8AuBybw");
var content = new StringContent("{\r\n \"transaction_id\": 2\r\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());