Title: Invalid request error message &#8211; Debugging
Last modified: April 20, 2026

---

# Invalid request error message – Debugging

 *  Resolved [imokweb](https://wordpress.org/support/users/imokweb/)
 * (@imokweb)
 * [3 weeks, 2 days ago](https://wordpress.org/support/topic/invalid-request-error-message-debugging/)
 * Hi there!
 * Some users are intermittently encountering an ‘Invalid request’ error on the 
   login form. Interestingly, after a browser refresh, they find themselves successfully
   logged in.
 * I haven’t been able to replicate this locally, and I don’t see a built-in logging
   option within the plugin settings. I have enabled `WP_DEBUG_LOG`, but no relevant
   errors are being captured.
 * What is the best way to debug this specific scenario? Are there specific hooks
   or hidden constants I can enable to track these ‘Invalid request’ instances?
   
   Thank you for your help!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finvalid-request-error-message-debugging%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Mustafa Uysal](https://wordpress.org/support/users/m_uysl/)
 * (@m_uysl)
 * [3 weeks, 2 days ago](https://wordpress.org/support/topic/invalid-request-error-message-debugging/#post-18885877)
 * Hi [@imokweb](https://wordpress.org/support/users/imokweb/),
 * Have you enabled AJAX mode? If so, and your site is using caching, this can explain
   the behavior you’re seeing.
 * Magic Login uses nonces for AJAX requests, and if the page is cached for too 
   long (for example 12+ hours), the nonce can expire while the cached page is still
   being served. In that case, users may see an “Invalid request” error, but after
   a refresh they get logged in because a fresh request with a valid nonce is generated.
 * I’d recommend keeping the cache TTL under ~12 hours for the page where Magic 
   Login is used, or excluding that page from cache entirely. Alternatively, you
   can switch to the non-AJAX method to avoid nonce-related issues.
 * I hope this helps.
 *  Thread Starter [imokweb](https://wordpress.org/support/users/imokweb/)
 * (@imokweb)
 * [3 weeks, 2 days ago](https://wordpress.org/support/topic/invalid-request-error-message-debugging/#post-18886487)
 * Hi Mustafa!
 * Thank you for the clarification — that makes sense.
 * I’ve made a few adjustments based on your recommendations:
    - Set the cache TTL to **11 hours**
    - Excluded **`/wp-admin/admin-ajax.php`** from cache
    - Excluded the **`magic-login` query string** from caching
    - Also excluded the **`/magic-login\*` URI** to be safe
      Exclude settings: [https://prnt.sc/qrp_aqYJcvTo](https://prnt.sc/qrp_aqYJcvTo)
      TTL Settings: [https://prnt.sc/KXYca_CBOCCP](https://prnt.sc/KXYca_CBOCCP)
 * I’d prefer to keep the **AJAX method enabled**, since the login form is loaded
   globally (it appears in a popup when users click “My Account” in the header),
   so disabling AJAX and cache isn’t really ideal in this case.
 * I’ll monitor things and see if these changes resolve the intermittent “Invalid
   request” issue.
 * Thanks again for pointing me in the right direction!
 *  Plugin Author [Mustafa Uysal](https://wordpress.org/support/users/m_uysl/)
 * (@m_uysl)
 * [3 weeks, 2 days ago](https://wordpress.org/support/topic/invalid-request-error-message-debugging/#post-18886742)
 * Hi [@imokweb](https://wordpress.org/support/users/imokweb/),
 * You’re welcome, I’m happy to help. Let me know if the problem persists.

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

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finvalid-request-error-message-debugging%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/magic-login/assets/icon.svg?rev=2783285)
 * [Magic Login - Passwordless Authentication for WordPress - Login Without Password](https://wordpress.org/plugins/magic-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/magic-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/magic-login/)
 * [Active Topics](https://wordpress.org/support/plugin/magic-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/magic-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/magic-login/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Mustafa Uysal](https://wordpress.org/support/users/m_uysl/)
 * Last activity: [3 weeks, 2 days ago](https://wordpress.org/support/topic/invalid-request-error-message-debugging/#post-18886742)
 * Status: resolved