Enrolling in MFA using the SMS Factor Using Self Service
This use case provides a step-by-step example of using the identity domains REST API for Self-Service enrollment in Multifactor Authentication (MFA) using SMS Factor.
Download the identity domains authentication use case examples collection and the global variables file from the idcs-rest-clients folder within the idm-samples GitHub repository and then import them into Postman.
Step1: Create the Self Service Enrollment Using the SMS
Factor
This step initiates SMS enrollment in a POST request to the
/admin/v1/MyAuthenticationFactorEnroller endpoint. The client
must include the following attributes:
value: defines the user id. You can make a GET call to
{{HOST}}/admin/v1/Me to get the "id" value.
displayName: defines the display name for the device
countryCode: defines the country code of the phone number
where the SMS text will be sent
phoneNumber: defines the phone number where the SMS text
will be sent
Request Example
The following example shows the contents of the POST request body in JSON format:
In the response, the deviceId and the requestId
should be passed in the next step.
Error Response Examples
The following example shows the error message in JSON format when the userId is invalid. You get a 400 HTTP response code.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:Error",
"urn:ietf:params:scim:api:oracle:idcs:extension:messages:Error"
],
"detail": "AuthenticationFactorEnroller.user references a User with ID 1fa35f74491d44ef5a7cc25bfdb1c8b1c that does not exist.",
"status": "400",
"urn:ietf:params:scim:api:oracle:idcs:extension:messages:Error": {
"messageId": "error.common.validation.invalidReferenceResource"
}
}
The following example shows the error message in JSON format if a
phoneNumber is incorrect. You get a 400 HTTP response code.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:Error",
"urn:ietf:params:scim:api:oracle:idcs:extension:messages:Error"
],
"detail": "Your phone number +91123 is not valid.",
"status": "400",
"urn:ietf:params:scim:api:oracle:idcs:extension:messages:Error": {
"messageId": "error.ssocommon.auth.invalidPhoneNumber",
"additionalData": {
"params": "+91123",
"msgId": "error.ssocommon.auth.invalidPhoneNumber"
}
}
}
Step 2: Initiate the Self Service Enrollment Using the OTP
by SMS 🔗
This step requests that the OTP be sent through SMS in a POST request to the /admin/v1/MyAuthenticationFactorInitiator endpoint. The client must include the following attributes:
requestId: received in the Step 1 response
deviceId: received in the Step 1 response
userName: username of the user
Request Example
The following example shows the contents of the POST request body in JSON format:
In the response, the attribute mfaStaus:"ENROLLED" indicates that user has enrolled for MFA. The mfapreferredAuthenticationFactor attribute indicates the factor set as the preferred method. In this case, it's SMS.
Note
This value may be different, if the first enrolled factor is different from SMS.
Error Response Examples
The following example shows the error message in JSON format if OTP is incorrect. You
get a 401 HTTP response code and the enrollment fails.