Create Authentication Code

POST {{authPath}}/{{envID}}/authenticationCodes

The POST /{{envID}}/authenticationCodes operation creates an authentication code for use in an MFA device authentication flow. The request body requires an application.id property value to associate an application with the MFA flow. The request also supports optional clientContext, lifeTime, and userApproval properties to provide relevant information to the mobile application. For example, the following message can be provided through the clientContext property:

"clientContext": {
        "header" : "Authentication process",
        "body": "Do you want to approve this transaction?"    
    }

The response returns the code and several other properties, including a status property to specify the status of the code. When the resouce is first created, the code's status is UNCLAIMED.

PropertyTypeRequired?
application.idStringRequired
clientContextStringOptional
lifeTime.durationIntegerOptional
lifeTime.timeUnitStringOptional
userApprovalStringOptional

See the Device authentications request data model for full property descriptions.

Request Body

{"application"=>{"id"=>"{{appID}}"}, "clientContext"=>{"header"=>"Authentication process", "body"=>"Do you want to approve this transaction?"}, "lifeTime"=>{"duration"=>2, "timeUnit"=>"MINUTES"}, "userApproval"=>"NOT_REQUIRED"}

RESPONSES

status: Created

{"_links":{"self":{"href":"https://auth.pingone.com/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/authenticationCodes/39743070-2f4c-4b26-a4ab-12287d0187dc"}},"id":"39743070-2f4c-4b26-a4ab-12287d0187dc","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"code":"B4D04NQR","uri":"pingonesdk?authentication_code=B4D04NQR","application":{"id":"7d8797b7-a097-46a9-841f-88f531d1d99b"},"clientContext":{"header":"Authentication process","body":"Do you want to approve this transaction?"},"lifeTime":{"duration":2,"timeUnit":"MINUTES"},"userApproval":"NOT_REQUIRED","status":"UNCLAIMED","expiresAt":"2022-02-22T21:03:08.132Z","updatedAt":"2022-02-22T21:01:08.118Z","createdAt":"2022-02-22T21:01:08.118Z"}