GDAP API: Account Activation and Recovery
Introduction
This article is describing our current GDAP API endpoint parameters, payloads and which call methods to use for specific tasks, and how to combine these workflows in C# implementation for Account Activation and Recovery.
Resource Links
Swagger UI - https://gdapbridge360.azurewebsites.net/api/swagger/ui
Base URL: https://gdapbridge360.azurewebsites.net/api/
Url: {baseurl}SecurityCode
Method: POST
Parameters
Key | Value | Description |
helmuts.reinis@appxite.com | Your AAD email address here | |
reset | true | Instruct API to initiate the token reset flow |
code | 123456 | Provide your security code that is received through email |
Example - Step 1 - Initiate Access Reset flow:
POST - https://gdapbridge360.azurewebsites.net/api/SecurityCode?email=helmuts.reinis@appxite.com&reset=true
JSON Response 1 (If Account is registered) :
true
An email will arrive in your Inbox:
JSON Response 1 (If Account is not registered) :
false
Example - Step 2 - Complete Access Reset flow:
POST - https://gdapbridge360.azurewebsites.net/api/SecurityCode?email=helmuts.reinis@appxite.com&code=590304
JSON Response 1 (If the wrong code is provided) :
{
"Result": "Accepted",
"Message": "false"
}
JSON Response 2 (Code Entered correctly) :
{
"Result": "Accepted",
"Message": "01vh2..........n97an"
}
In addition, an email will be dispatched to your inbox with the same information:
C# Method Example - Send Reset Request:
public async Task<string> SendResetRequest(string baseUrl, string Username)
{
string uri = $"{baseUrl}SecurityCode?email={Username}&reset=true";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "POST";
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
return await reader.ReadToEndAsync();
}
}
Calling this method from code:
var initiateCodeReset = await loginAPI.SendResetRequest(CurrentBaseUrl, Username);
C# Method Example - Send Code Validation Request:
public async Task<string> ValidateSecurityCode(string baseUrl, string Username, string Code)
{
string uri = $"{baseUrl}SecurityCode?email={Username}&code={Code}";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "POST";
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
return await reader.ReadToEndAsync();
}
}
Calling this method from code:
var verifyCodeResult = await loginAPI.ValidateSecurityCode(CurrentBaseUrl, Username, SecurityCode);
Add comment
Please sign in to leave a comment.