Title: SWPM cannot process this access request
Last modified: February 11, 2023

---

# SWPM cannot process this access request

 *  Resolved [juanguillermo](https://wordpress.org/support/users/juanguillermo/)
 * (@juanguillermo)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/swpm-cannot-process-this-access-request/)
 * Hello! I am developing a web application that uses WordPress as a backend (Headless).
   That is, I consume the WordPress resources and database from the app created 
   in Vue with Node.js through the Rest API.
 * User creation is simple and I have it figured out. What I’m having problems with
   is the login.
 * Apparently (and according to WordPress) SWPM is blocking the login.
 * More details now:
    1. I send my app username and password to WordPress by Rest API using node-fetch(
       GET method).
    2. In WordPress I have an Endpoint inside a Custom Plugin (code below).
    3. This endpoint retrieves the URI parameters and sends them to wp_signon to sign
       in.
    4. If wp_signon succeeds in logging in, it returns the user’s data. If not, it 
       returns an error array.
 * This is the custom endpoint en WP:
 *     ```wp-block-code
       // Register REST API endpoints
       class Login_REST_API_Endpoints {
   
           /**
            * Register the routes for the objects of the controller.
            */
           public static function register_endpoints() {
               // endpoints will be registered here
               register_rest_route( 'wp', '/login', array(
                   'methods' => 'GET',
                   'callback' => array( 'Login_REST_API_Endpoints', 'login' ),
       			'permission_callback' => '__return_true'
               ) );
           }
   
           /**
            * @param WP_REST_Request $request Full data about the request.
            * @return WP_Error|WP_REST_Request
            */
       	public static function login( $request ) {
   
   
       		$data = array();
       		$data['user_login'] = $request["email"];
       		$data['user_password'] =  $request["password"];
       		$data['remember'] = true;
       		$user = wp_signon( $data, false );
   
       		if ( !is_wp_error($user) ){
       			return $user;
       		} else {
       			return $error = json_encode(array('error' => true));
       		}
   
       	}
       }
       add_action( 'rest_api_init', array( 'Login_REST_API_Endpoints', 'register_endpoints' ) );
       ```
   
 * So far so good. The problem appears when I activate the SWPM plugin.
 * I start getting this response (the asterisks are intentional, to hide the real
   info):
 *     ```wp-block-code
       {
       	"code": "wp_die",
       	"message": "<p>Warning! The Simple Membership plugin cannot process this access request to prevent you from accidentally logging out as WP admin.<\/p><p><a href=\"https:\/\/*********\/wp-admin\/profile.php\" target=\"_blank\">Click here<\/a>to see the profile with which you are logged in in this browser.<\/p><p>In this browser you have connected to the site as an administrator user. First, log out as WP admin and then you will be able to log in as a member.<\/p><p>Alternatively, you can use a different browser (where you are not logged in as an administrator) to test membership access.<\/p><p>Your frequent visitors or members will never see this message. This message is ONLY for the admin user.<\/p>",
       	"data": {
       		"status": 500
       	},
       	"additional_errors": []
       }
       ```
   
 * And these are the headers when the error happens (the asterisks are intentional,
   to hide the real info):
 *     ```wp-block-code
       Date: Sat, 11 Feb 2023 02:58:36 GMT
       Server: Apache
       Set-Cookie: swpm_session=52883ad4e8ad887e7***************; path=/
       X-Robots-Tag: noindex
       Link: <https://******/wp-json/>; rel="https://api.w.org/"
       X-Content-Type-Options: nosniff
       Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages, Link
       Access-Control-Allow-Headers: Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type
       Expires: Wed, 11 Jan 1984 05:00:00 GMT
       Cache-Control: no-cache, must-revalidate, max-age=0
       Content-Length: 890
       Connection: close
       Content-Type: application/json; charset=UTF-8
       ```
   
 * I already tried:
    - Close all sessions.
    - Delete cookies and cache.
    - Deactivate plugin and activate them one by one.
    - Test with different browsers.
    - Try with Insomnia.
 * And nothing works.
 * The only thing I have noticed is that when SWPM is disabled, the request is successful(
   code 200).
 * Could you please give me some idea of what might be going on and how I could 
   fix it?
 * In use:
    - SWPM 4.2.4.
    - WP 6.1.1.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [juanguillermo](https://wordpress.org/support/users/juanguillermo/)
 * (@juanguillermo)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/swpm-cannot-process-this-access-request/#post-16460965)
 * **Update:**
   When I GET request from Insomnia, if the SWPM plugin is active, I
   get a 500 error in the response body. But if it’s inactive, I get the 200 code,
   user data in the body, and WP login cookies in the header.
 * Insomnia’s settings say that it automatically stores these cookies and sends 
   them when they are needed.
 * Now (the interesting thing) if I reactivate the SWPM plugin and do GET, I get
   code 200, the user data and NEW WP login cookies + SWPM login cookies.
 * From then on, all the requests you make to WP will be code 200. Logically, in
   each login request the cookies change.
 * Now, if I copy these cookies to my fetch code in Node.js, I also get 200 code
   from WP, even if the SWPM plugin is enabled.
 * Logically, these cookies expire and it is not something that can be used in production,
   but this information may help to solve the problem.
 *  Plugin Support [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/swpm-cannot-process-this-access-request/#post-16462420)
 * Hi,
 * Are you following our instructions below?
 * [https://simple-membership-plugin.com/simple-membership-api-creating-member-account-using-http-post-request/](https://simple-membership-plugin.com/simple-membership-api-creating-member-account-using-http-post-request/)
 * Kind regards.
 *  Thread Starter [juanguillermo](https://wordpress.org/support/users/juanguillermo/)
 * (@juanguillermo)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/swpm-cannot-process-this-access-request/#post-16462445)
 * Hello!
 * Yep, in fact, I am creating the user using the SWPM API.
 * However the documentation doesn’t say anything about Login.
 * Do you have an API for login?
 * What part of the plugin is blocking login through the WordPress API?
 * Regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘SWPM cannot process this access request’ is closed to new replies.

 * ![](https://ps.w.org/simple-membership/assets/icon-128x128.png?rev=974529)
 * [Simple Membership](https://wordpress.org/plugins/simple-membership/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-membership/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-membership/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-membership/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-membership/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-membership/reviews/)

## Tags

 * [API REST](https://wordpress.org/support/topic-tag/api-rest/)
 * [login](https://wordpress.org/support/topic-tag/login/)
 * [signon](https://wordpress.org/support/topic-tag/signon/)

 * 3 replies
 * 2 participants
 * Last reply from: [juanguillermo](https://wordpress.org/support/users/juanguillermo/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/swpm-cannot-process-this-access-request/#post-16462445)
 * Status: resolved