• Resolved imokweb

    (@imokweb)


    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 to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mustafa Uysal

    (@m_uysl)

    Hi @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

    (@imokweb)

    Hi Mustafa!

    Thank you for the clarification — that makes sense.

    I’ve made a few adjustments based on your recommendations:

    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

    (@m_uysl)

    Hi @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 to reply to this topic.