User Self Get Username

Centrify's authentication APIs provide a feature to send a username to an email address. This is typically used when the user forgot their system username when trying to authenticate. Using this feature, a user specifies the email address corresponding to their system account and their username is then emailed to them.

Before continuing, ensure you are familiar with:

To email a username to a user via the API:

  1. Invoke /Security/StartForgotUsername:
POST https://tenant.my.centrify.net/Security/StartForgotUsername

{
   "Version":"1.0"
}

The Challenges array in the response contains mechanisms that must be fulfilled to advance the process and send an email to the user, similar to Advancing the Authentication:

{  
   "success":true,
   "Result":{  
      "ClientHints":{  
         "PersistDefault":false,
         "AllowForgotPassword":false,
         "AllowPersist":false
      },
      "TenantId":"ABC123",
      "Summary":"NewPackage",
      "SessionId":"-1",
      "Challenges":[  
         {  
            "Mechanisms":[  
               {  
                  "Name":"EnterEmail",
                  "AnswerType":"Text",
                  "MechanismId":"2Vq2ILiv57l...",
                  "ServiceName":"security/AdvanceForgotUsername"
               }
            ]
         }
      ],
      "Version":"1.0"
   },
   "Message":null,
   "MessageID":null,
   "Exception":null,
   "ErrorID":null,
   "ErrorCode":null,
   "InnerExceptions":null
}

The Mechanisms object in the response contains:

  • Name: Specifies the information the user needs to provide (e.g. an email address).
  • AnswerType: The type of information required to fullfil the challenge (e.g. text).
  • MechanismId: The unique ID of the challenge mechanism.
  • ServiceName: The name of the next endpoint to invoke in order to advance the process and send the user an email with their username.
  1. Invoke the endpoint specified in the ServiceName field. Based on the example response above, invoke /Security/AdvanceForgotUsername and pass the user's email via the Answer field:
POST https://tenant.my.centrify.net/security/AdvanceForgotUsername

{  
   "TenantId":"ABC123",
   "SessionId":"-1",
   "PersistentLogin":null,
   "MechanismId":"2Vq2ILiv57l...",
   "Answer":"[email protected]",
   "Action":"Answer"
}

After invoking this request Centrify will attempt to send an email to the specified email address containing the username. If this process was successful, the success field in the response will be set to True and the ClientMessage will indicate that the username was sent:

{  
   "success":true,
   "Result":{  
      "ClientMessage":"An email with your username has been sent to: [email protected]",
      "Summary":"NoncommitalSuccess"
   },
   "Message":null,
   "MessageID":null,
   "Exception":null,
   "ErrorID":null,
   "ErrorCode":null,
   "InnerExceptions":null
}