• Resolved tocleora

    (@tocleora)


    All the examples on the site show passing the parameters through the url.

    I’m trying to use Postman to test this. I can get it working if I do this:

    [POST] https://[site]
    [params]
    username=test
    password=testing
    rest_route=/simple-jwt-login/v1/auth

    But can I not do this?

    [POST] https://[site]
    [params]
    rest_route=/simple-jwt-login/v1/auth
    [Body]
    {
    “username”:”test”,
    “password”:”testing”
    }

    If I try the second, I get this:

    {
    “success”: false,
    “data”: {
    “message”: “The email or username parameter is missing from request.”,
    “errorCode”: 46
    }
    }

    Do I have to send the details through the url? If not can someone provide me an example?

    Also, should this not require an AUTH_KEY? What is keeping anyone from connecting to this other than ip address restriction?

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Nicu Micle

    (@nicu_m)

    Hello @tocleora,

    For all the endpoints, you can send the parameters as query parameters, or you can send them in the request body.

    For example, in Postman, go to “Body” -> “form-data”, and there you can add your parameters.

    Here is a PHP example, of how you can make a request by sending the parameters in the post body:

    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://yoursite.com/?rest_route=/simple-jwt-login/v1/auth',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_POSTFIELDS => array('username' => 'myusername','password' => 'your_password'),
    ));
    
    $response = curl_exec($curl);
    
    curl_close($curl);
    echo $response;

    `

    You can find documentation here: https://github.com/nicumicle/simple-jwt-login/wiki/Register-User

    I will prepare a Postman collection in the following days and add that to the documentation.

    Meanwhile, please let me know if you manage to test the plugin, and feel free to give me feedback.

    For the AUTH-KEY, there is a section in the plugin settings called “AUTH-CODES”. At the moment, you can use this, only for “Login” and “Register”. But, I will add this feature to my to-do list.

    Best regards,
    Nicu.

    • This reply was modified 3 years, 11 months ago by Nicu Micle.
    Plugin Author Nicu Micle

    (@nicu_m)

    Hello @tocleora,

    Here you can find a postman collection with all the plugin endpoints.

    https://github.com/nicumicle/simple-jwt-login/tree/master/postman

    Best regards,
    Nicu.

    Thread Starter tocleora

    (@tocleora)

    This helped, thank you very much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘understanding paramaters’ is closed to new replies.