Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Acquire the Authentication ID – To begin the process, invoke the ui/common/ModernAuth/GetModernAuthID REST endpoint to obtain the Authentication ID. The C# code snippet below illustrates this step:

    Code Block
    languagec#
    private static string GetID()
    {
      var web = new WebClient();
      var urla = $"https://my.empoweriempowerid/ui/common/ModernAuth/GetModernAuthID";
      var responseString = web.DownloadString(urla);
      return responseString;
    }
  2. Perform Authentication – Launch a browser or a browser tab and direct it to the '/PerformAuth' endpoint. Provide the Authentication ID acquired in the first step ('{sid}') and the Client ID of the OAuth application ('{clientId}') as parameters. The URL should look similar to that shown below.
    https://my.empowerid/ui/common/ModernAuth/PerformAuth/?sid={sid}&client_id={clientId}

    Insert excerpt
    IL:Callouts
    IL:Callouts
    nameModernAuthSuccess
    nopaneltrue

  3. Obtain the Access Token – Invoke the /ui/common/ModernAuth/GetAccessToken/ REST endpoint using the Authentication ID acquired in the first step ('{sid}'). If the endpoint returns an empty response, the access token is not available. You can repeatedly call this endpoint with the Authentication ID at intervals of 10 to 15 seconds for a minute or two before determining that the authentication has failed. The C# code snippet below illustrates this step:

    Code Block
    languagec#
    private static string GetToken()
    {
      var web = new WebClient();
      var urla = $"https://my.empoweriempowerid/ui/common/ModernAuth/GetAccessToken/{sid}";
      var responseString = web.DownloadString(urla);
      if(!string.IsNullOrEmpty(responseString))
      {
        var data = JsonConvert.DeserializeObject<DataClass>(responseString);
        return data.AccessToken
      }
      return null;
    }
    
    public class DataClass
    {
      public string AccessToken {get; set;}
      public string {get; set;}
    }

...