Support » Plugin: Force Login » API Formidable Forms

  • Resolved mbillips

    (@mbillips)


    The API for formidable forms does not seem to work. I am calling it to add entries to a form. I have exhausted all the trouble shooting options from formidable. It occurred to me that I was using the login plugin that might be causing the problem.
    I am getting the following error
    {
    “code”: “rest_unauthorized”,
    “message”: “Only authenticated users can access the REST API.”,
    “data”: {
    “status”: 401
    }
    }

    Is there a setting that I should be aware of that could be limiting the access?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Kevin Vess

    (@kevinvess)

    Hi– thanks for using Force Login!

    Force Login restricts access to the REST API for authorized users only.

    Try one of the following code snippets to allow the WP REST API to be publicly accessible again:

    add_filter( 'rest_authentication_errors', '__return_true' );
    

    Or

    remove_filter( 'rest_authentication_errors', 'v_forcelogin_rest_access', 99 );
    

    Thank you for the quick response.
    Sorry, but where should this code be added? Also, what might be the difference in the two options?

    Oops just re-read your note . snippets… i got it thanks

    Tried both methods … getting a different error
    {
    “code”: “rest_forbidden_context”,
    “message”: “Sorry, you are not allowed to create entries”,
    “data”: {
    “status”: 403
    }
    }

    Plugin Author Kevin Vess

    (@kevinvess)

    Hi–

    where should this code be added?

    You would add the code to your theme or child theme’s functions.php file.

    what might be the difference in the two options?

    The first example sets the REST authentication to always be true, or authenticated. Where as the second example removes the Force Login filter v_forcelogin_rest_access which is what limits the REST API to only be accessible by logged-in users.

    Tried both methods … getting a different error

    Both methods successfully unlocked your REST API with Force Login. This new error you’re getting is not caused by or related to Force Login.

    The API for formidable forms does not seem to work. I am calling it to add entries to a form.

    This is now true again– that new error says, “Sorry, you are not allowed to create entries.” I would contact formidable forms about this new error.

    Good luck!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.