<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z0000ABvwIcCQJOkta Classic EngineAuthenticationAnswered2025-08-20T09:00:12.000Z2024-07-18T08:44:23.000Z2024-07-31T16:35:57.000Z

h73yz (h73yz) asked a question.

Enroll a yubikey to a user using Okta API (without the need of the user password)

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.


  • Paul S. (Okta, Inc.)

    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.

    Expand Post
    Selected as Best
  • Paul S. (Okta, Inc.)

    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.

    Expand Post
    Selected as Best
This question is closed.
Loading
Enroll a yubikey to a user using Okta API (without the need of the user password)