• Resolved mathskater

    (@mathskater)


    Hello,
    I installed the plugin for 1 year it works great thank you. But for a few days it’s impossible to create user accounts with REST API user. Could the plugin be the cause ? Thanks

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

    (@kevinvess)

    Hi, thanks for using Force Login!

    Force Login uses the?rest_authentication_errors?filter to check for REST API authentication. If no authentication is used, it blocks the request.

    You can either disable our filter function or hook into it yourself to allow the specific endpoint to be accessed without authentication.

    Check out this related support thread:
    https://www.ads-software.com/support/topic/bypassing-only-specific-rest-endpoint/

    And:
    https://www.ads-software.com/support/topic/exception-for-api/

    Thanks!

    Thread Starter mathskater

    (@mathskater)

    I’m sorry for responding late. We managed to circumvent the problem.
    On the other hand we have another problem, we use the plugin Mapster WP Maps the maps are not displayed.

    There is a error : XHRGET https://safer.local/wp-json/mapster-wp-maps/map?id=1296 [HTTP/2 401 Unauthorized 4511ms]

    Thanks in advance.

    Plugin Author Kevin Vess

    (@kevinvess)

    Hi, I’m glad you got it working!

    Your other problem, the error message you shared, is not part of Force Login. You’ll need to contact the support team for the Mapster WP Maps plugin to resolve that issue.

    Thanks!

    Hi there, I am having the same problem. I keep getting this error “Error occurred: Message = {“code”:”rest_unauthorized”,”message”:”Only authenticated users can access the REST API.”,”data”:{“status”:401}} | Status = 401″ when trying to send an incoming webhook.

    I have proved your plugin to be the culprit since once I deactivate it, webhook works. This is bc your plugin blocks rest api calls without authentication. I have already tried adding the code you shared at the end of this thread https://www.ads-software.com/support/topic/bypassing-only-specific-rest-endpoint/ as such:

    function my_forcelogin_bypass_rest_api( $result ) {
    
    // Skip if request is authenticated
    if (!empty($result)) {
        return $result;
    }
    
    if ($_SERVER['xtremeplatform.com'] == '/wp-json/uap/v2/uap-16589-16590') {
        return true;
    }
    
    return $result;
    }
    add_filter( 'rest_authentication_errors', 'my_forcelogin_bypass_rest_api', 20 );

    This however is not working and same 401 error remains. Please let me know how to properly add this exception AND how to add more than 1 exception URLs. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘REST API user’ is closed to new replies.