
v9y6n (v9y6n) asked a question.
Hello,
I am trying to retrieve a bearer token from okta, using curl.
But somhow there is an error in my curl command.
Can somebody help me out and give me a clue to understand why this is not right?
curl -v -X POST https://xxxxxxx.com/api/v1/authn ^
--header "Accept: application/json" ^
--header "Content-Type: application/json" ^
--data "username": "xxxx@xxxx.com" ^
--data "password": "xxxxx" ^
--data "options": {"multiOptionalFactorEnroll": false,"warnBeforePasswordExpired": false}
the answer i get :
{"errorCode":"E0000003","errorSummary":"The request body was not well-formed.","errorLink":"E0000003","errorId":"oaeol4MgkuvRNSdyY3DxtO2sQ","errorCauses
I want to retrieve the b

Hello Harold,
It looks like this curl command should be slightly changed to be closer to what's needed for making this call. I went ahead and generated one for the authn call here through Postman and got this:
curl --location --request POST "https://xxxx.okta.com/api/v1/authn" ^
--header 'Accept: application/json' ^
--header 'Content-Type: application/json' ^
--data-raw '{
"username": "",
"password": "",
"options": {
"multiOptionalFactorEnroll": true,
"warnBeforePasswordExpired": true
}
}'
You can download our collections for Postman from here: https://developer.okta.com/docs/reference/postman-collections/ - and after doing so and setting up these calls, the "Code" option should let you generate what you need for curl commands.