Support » Plugin: Force Login » Issues with REST API

  • Resolved bohcurtis

    (@bohcurtis)


    I am having issues using Gravity Flow Form Connector on the same server as this plugin. I believe it may be blocking the REST API functionality for me. I have commenting out the REST API section in the plugin code but it is still having the same issues. Any help is appreciated.

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

    (@kevinvess)

    Hi, thanks for using Force Login!

    If you deactivate Force Login, are you still having issues?

    Thread Starter bohcurtis

    (@bohcurtis)

    No, it works perfectly fine once Force Login is disabled

    Thread Starter bohcurtis

    (@bohcurtis)

    Could I maybe whitelist a certain IP address? Is that possible?

    Plugin Author Kevin Vess

    (@kevinvess)

    You can bypass Force Login based on any condition by adding the v_forcelogin_bypass filter to your site. Check out the FAQs for an example.

    Thread Starter bohcurtis

    (@bohcurtis)

    I can see how to use this for pages on my website, but how would I whitelist all of REST API? I do not have URLs for them, as it all behind-the-scenes through a plugin I use

    Plugin Author Kevin Vess

    (@kevinvess)

    You said you commented out the REST API code in Force Login and that it still wasn’t working. I assumed you were now asking about how to bypass the login redirect.

    The v_forcelogin_bypass filter should return a true|false boolean value to determine whether or not Force Login runs. Your condition can be checking if the visitor’s IP address matches the one(s) you want to allow.

    However, if you issue isn’t with the force login redirect, but with Force Login’s restriction to the REST API for authorized users, you may allow the REST API to be publicly accessible again by adding one of the following code snippets to your functions.php file:

    add_filter( 'rest_authentication_errors', '__return_true' );
    

    OR

    remove_filter( 'rest_authentication_errors', 'v_forcelogin_rest_access', 99 );
    
    Thread Starter bohcurtis

    (@bohcurtis)

    I have tried both of those code snippets separately in my functions.php file with no luck. Any other ideas?

    Plugin Author Kevin Vess

    (@kevinvess)

    If removing the REST API restriction (either with filters or code commenting) does not resolve the issue, then I would assume that is not the cause of the issue.

    Maybe try enabling WP_DEBUG mode and checking your error logs for any clues of what’s failing and where.

    You might need to dig into the Gravity Flow Form Connector plugin code to see what that plugin is trying to do and when, to figure out how to allow Force Login to bypass it.

    Let me know if you figure out what the cause is and what your solution ends up being.

    Good luck!

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