• Resolved abdokouta

    (@abdokouta)


    each time i try the request over postman i get Username field ‘username’ is required. here is my body (raw) content ->
    {

    “Username”: “test”,
    “email”: “[email protected]”,
    “password”: “test”

    }

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

    (@sk8tech)

    @abdokouta

    You should use
    {

    “username”: “test”,
    “email”: “[email protected]”,
    “password”: “test”

    }

    Instead of “Username”, use “username”

    Thread Starter abdokouta

    (@abdokouta)

    it works thanks ?? . one more thing how to secure all wp api i have added this code to function.php ->
    add_filter( ‘rest_api_init’, ‘rest_only_for_authorized_users’, 99 );
    function rest_only_for_authorized_users($wp_rest_server){
    if ( !is_user_logged_in() ) {
    wp_die(‘sorry you are not allowed to access this data’,’cheatin eh?’,403);
    }
    }
    it works fine with browser but with postman i still can access the api without auth. any help?

    Plugin Author sk8tech

    (@sk8tech)

    @abdokouta That depends on how you handle your auth, which is out of the scope of this plugin.
    Find help from your auth plugin, e.g. OAuth 2.0, JWT, or others.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Username field ‘username’ is required.’ is closed to new replies.