
h73yz (h73yz) asked a question.
Background
Currently, when setting up a new computer for a user, we require their password and multiple approvals via the Okta Verify app. This process can be time-consuming and inconvenient, especially when users are in meetings and not responsive.
To streamline this, I tested using YubiKeys for authentication. I manually enrolled users on their current computers and used the YubiKey along with their password. This method reduced the need for repeated approvals via Okta Verify and worked well (besides the inconvenience of knowing their password which i am not a very big fan of but there is no other way currently) .
I thought of a way to better automate this process further by using the Okta API to enroll YubiKeys for users, eliminating the need to ask for their input during the setup and perhaps even use just the yubikey to do so.
Issue Encountered
While attempting to use the Okta API, I followed the documentation at Okta API Reference but encountered the following error:
json
Copy code
{
"errorCode": "E0000003",
"errorSummary": "The request body was not well-formed.",
"errorLink": "E0000003",
"errorId": "oaeBp80HldlRLG1aqmWBdTiAQ",
"errorCauses": []
}
API Request Format Used
Here is the curl command I used:
bash
Copy code
curl -v -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "User-Agent: Mozilla/5.0 (${systemInformation}) ${platform} (${platformDetails}) ${extensions}" \
-H "Authorization: SSWS ${api_token}" \
-d '{
"factorType": "token:hardware",
"provider": "YUBICO",
"verify": {
"passCode": "cccccceukngdfgkukfctkcvfidnetljjiknckkcjulji"
}
}' "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors"
I am not sure why this request is not working. Can you please assist in identifying the issue and provide guidance on the correct usage of the API for this purpose if its possible?
Thank you.

Hello @h73yz (h73yz) Thank you for posting on our Community page!
Based on the error you receive there, it seems that the Body of the API call is not correct. Please see our doc on the Yubikey and how the body should look like:
https://developer.okta.com/docs/reference/api/factors/#enroll-yubikey-factor
Thank you for reaching out to our Community and have a great day!
--
Help others in the community by liking or hitting Select as Best if this response helped you.