• ifwarewp

    (@ifwarewp)


    Sending POST with existing WP user name, in json encoded ‘body’, and get this {“code”:”rest_missing_callback_param”,”message”:”Missing parameter(s): user”,”data”:{“status”:400,”params”:[“user”]}}

    In authentication header sent user_name:password base64 encoded

    What is wrong, please?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    It seems like the user parameter isn’t present in your request.

    Can you share more detail about how you’re constructing the request?

    If I had to guess, maybe you’re missing the application/json Content-Type header.

    Thread Starter ifwarewp

    (@ifwarewp)

    Once added the ‘Content-Type’ header, response has changed. The user ‘test’ has full ‘admin’ permissions. This POST request is posted using same user ‘test’. Could this create a ‘loop’?

    • ?[‘url’]=”https://my_domain.com/wp-json/one-time-login/v1/token”
    • [‘body’]='{\n \”delay-delete\”: true,\n \”count\”: 3,\n \”user\”: \”test\”\n}’
    • [‘headers’]=table
      •  [‘Content-Type’]=’application/json’
      •  [‘authorization’]=’Basic dA********9z’

    The authentication header has “test:<password>” encoded in base64.

    Response:

    {“code”:”rest_forbidden”,”message”:”Sorry, you are not allowed to do that.”,”data”:{“status”:401}}

    Thank you for looking into this.

    • This reply was modified 1 year ago by ifwarewp.
    • This reply was modified 1 year ago by ifwarewp.
    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    It seems like your application password or the authorization header isn’t working, for whatever reason. I can’t diagnose further without access to your system.

    Thread Starter ifwarewp

    (@ifwarewp)

    Expected “one-time login URLs for any existing user”. User ‘auser’ exists. But the cUrl call returns Site’s front page instead of a link to login page. What do I miss here, please? It is a dev site to figure out this Plugin. Thank you for your time and advice.

    curl -X POST https://ifwtrainin3dev.wpenginepowered.com/wp-json/one-time-login/v1/token -H ‘authorization: Basic dGVzdDpQYXNzQWNlZ2kjMj8z’ -H ‘cache-control: no-cache’ -H ‘Content-Type: application/json’ -d ‘{“user”:”auser”,”count”: 3,”delay-delete”: true}’

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Trying the ‘Example with cUrl’’ is closed to new replies.