Title: How to Securely Handle AJAX Authentication in a Custom WordPress Template?
Question:
Hi everyone,
I'm designing a custom template in WordPress that includes a form. When a user submits the form, a follow-up code for a service needs to be submitted. The process involves two AJAX requests:
1.The first AJAX request obtains a user & password to another server using authentication. The second AJAX request uses this token and the follow-up code to get a response from the server, which is then displayed to the user.
2.The issue is that I need to include the authentication username and password in the AJAX request to obtain the token from the server.
Is there a secure way to handle this in WordPress without exposing the credentials in the client-side JavaScript? Does WordPress provide a solution for securely embedding authentication details in AJAX requests?
I try enqueue the auth as an array in wordpress. but when I see the codes of page I can see the data in front page.
Thanks for your help!