Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Is it safe to manually sign a user in using AJAX?

Assuming you do not do stupid things, and use properly the relevant API, an AJAX login form can be as secure as the “core” login form.

The way you transfer the data is not very important by itself. Even HTTP, although people and google will claim as being insecure, can probably be secure enough with 2FA, one time passwords, or just use your own cellular connection instead of coffee shop/work WiFi/network. In any case this is up to the site’s owner to decide.

As for point 3, wp_signon is the right one and from there all the authentication and setting of cookies should be done.

One thing to keep in mind when doing AJAX, is that a successful login will not by itself reflect the new status in the UI without some extra work, and the easiest path is probably to just refresh the page which makes the whole AJAX idea much less appealing.

Another obstacle you will face is error reporting, like user/password mismatch, you will need to make a way to transfer the login errors to the front-end and make it in a generic enough way to let other login related plugins to add their own errors.

If it sounds like I am against login via AJAX, I guess I am, but this is just a personal opinion, there is nothing technically impossible or insecure about it.

Related Posts:

  1. WordPress Ajax Data Security
  2. wp_set_auth_cookie() doesn’t work in Ajax call
  3. Nonces and Cache
  4. Is it safe to assume that a nonce may be validated more than once?
  5. Multiple ajax nonce requests
  6. WordPress AJAX Login Screen
  7. Detecting post type within init action
  8. WordPress Ajax Login without page reload
  9. WordPress Nonce Issue for Ajax Login and Logout
  10. How can I automatically login using a URL?
  11. how to use reCaptcha v3 in wordpress custom login form?
  12. Nonces, AJAX, script variables & security in WordPress
  13. How do I check if AJAX nonces are implemented correctly?
  14. WP Admin AJAX Security – using POST to include a relative URL
  15. ajax nonce verification failing
  16. Why a strange discrepency between get_current_user_id() when using AJAX versus output of document.cookie?
  17. Should I check for privileges before hooking into `wp_ajax_$handle` or after?
  18. Ajax login without redirect/reload
  19. Is it secure to use admin-ajax.php in front?
  20. Interim-Login form on frontend
  21. Custom Login with Ajax not working with IE
  22. Why does check_ajax_referer give a 403 error on https websites?
  23. Using nonce when loading posts with AJAX
  24. 200 return code on ‘POST /wp-admin/admin-ajax.php’ while NOT logged in
  25. Custom RPC end-point security best pratice?
  26. Should wordpress nonce be placed in html form or in javascript file
  27. jQuery.post returns 0
  28. Ajax login fails: script sets cookies, but is_user_logged_in() returns false
  29. How to prevent my external API call from being called by anyone but me (my site)
  30. check_ajax_reffer not working when logged
  31. WordPress custom ajax login not working on mobile browsers
  32. How to safely pass post_id and user_id via AJAX to the backend (prevent user from changing it via JS)?
  33. Ajax Security regarding user priviliges and nonces
  34. Can I make an ajax response cross-domain?
  35. How to stop a nonce from being cached in an inline script, or alternatives to regenerate it if expired?
  36. How does the security of admin_ajax.php work?
  37. Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
  38. JavaScript implementation of Gzip
  39. How to cache json with wp-super cache
  40. WordPress AJAX with Axios
  41. Limiting sessions to one IP at a time
  42. Admin Notification after save_post, when ajax saving in gutenberg
  43. Initialize JS with an ajax loaded ACF form
  44. How to modify wp_ajax function?
  45. Nonces and Ajax request to REST API and verification
  46. Websites defaced by uploading script using theme editor
  47. Vue.js + AJAX Shortcode
  48. Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
  49. wp_remote_get() to get AJAX url /wp-admin/admin-ajax.php
  50. wp_ajax action is not running
  51. Ajax – gettext without a plugin
  52. How do I set the url to make an ajax request for a html document?
  53. wp-admin AJAX with Fetch API is done without user
  54. Ajax stops working when logged in?
  55. WordPress ajax get content post id
  56. Populating content dynamically via AJAX and Advanced Custom Fields [closed]
  57. wp-admin folder, brute force, and password protection
  58. My ajax code not returning ajax value
  59. register ajax calls hook
  60. Long Polling: Stuck in while loop
  61. Show Post Content with AJAX
  62. update_post_meta using ajax
  63. How to export custom database data to excel file
  64. How to update Comment post meta through an Ajax call
  65. POST Ajax bad request
  66. Ajax for subscibers not working
  67. i’m trying to get all my media query attachments via ajax in wordpress
  68. Distinguish between 2 instances of admin-ajax.php
  69. How to update post with Ajax (no plugin)
  70. Next Ajax call doesn’t work
  71. Ajax page load without reload
  72. need a confirmation text to appear on email submission
  73. Including ‘wp-load.php’ after another include() generates an error
  74. I need to find which is the file that checks the DB for correct login (username, password)
  75. WordPress Ajax Page Load to skip embedded iframe
  76. edit user input data contact form 7
  77. How to keep scripts persistent during admin-ajax process when saving widget?
  78. Search function – problem with whole words
  79. jQuery ajax method does not return data
  80. WordPress 403 error on form submission with Ajax
  81. Ajax is not defined
  82. $.ajax results in 403 forbidden
  83. Get posts by category via ajax
  84. Download doccument on server rather than clients browser
  85. Load oEmbed iframe within ajax call
  86. Adding pagination to Ajax Query
  87. Create secondary Archive page format?
  88. Get post details with pure javascript ajax
  89. WorddPress website admin part not working correctly – I think ajax/json issue
  90. How to populate data from JSON using AJAX in TypeScript? [closed]
  91. Use ajax without a plugin?
  92. Weird admin-ajax.php problem
  93. Ajax contact form returnig 0
  94. Know which script/page is being called by ajax call
  95. Can’t update WP Editor after Ajax
  96. Posting to loop.php file
  97. How to get current_user_id from wordpress in node js?
  98. AJAX call not initializing for non-admins in WordPress
  99. How to use Ajax with WordPress
  100. Using $.ajax getting 500 error
Categories ajax Tags ajax, login, security
Inconsistent behavior from number_format
Encrypt / Decrypt Post Title and Details

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress