<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
0D54z000073DRkJCAWOkta Identity EngineAPI Access ManagementAnswered2024-03-25T21:17:24.000Z2021-07-06T13:44:03.000Z2021-07-09T18:57:51.000Z

v9y6n (v9y6n) asked a question.

Bearer token

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.

    Expand Post
This question is closed.
Loading
Bearer token