OVERVIEW
This KB article will teach you how to extract one key/value pair from a list of objects in Okta Workflows.
SOLUTION
You used Okta’s /api/v1/users/ID/factors API endpoint to retrieve the MFA factor list for a user. You need to retrieve the phone number from the SMS factor.
The following flow extracts the phone number.
Flow to extract one factor type.
The flow has the following steps:
- Get the current user ID using the Okta – Read User card.
- Set up the URL to retrieve the user’s MFA factors.
- Make a call to retrieve the user’s MFA factors.
- The List – Find card finds the first item in a list that meets a specified condition. The card receives a list of objects. It finds the object where factorType is equal to sms. The card’s output retrieves the phoneNumber field from the object (instead of using the Object – Get card).
You can pass the phoneNumber to another card:
Connecting the phone number to other cards.
When running the flow, the Find card receives four objects (four factors):
MFA factors.
And returns the object the factorType is sms:
The List – Find card returns one object.
RELATED REFERENCES
