Sending a http request with custom headers with html alone (without using javascript)

29 views Asked by At

I was creating a feature for my application which: sends a confirm-user-action mail to the user to authorize an important task by the user-itself via the convinience of their mail. So what i need is that the mail-template contains 2 buttons for approve and reject. Now since all kind of scripting is blocked by the gmail, I just can't make any http calls with javascript.

I was thinking of creating a simple html template with a <form target='my-domain/api/endpoint' method='POST'> <button>Submit</button><button>reject</button></form> to the template such that when ever i click the submit button, it hits the endpoint on my server side and approves or rejects the task. Now the problem lies that the api-endpoint is protected and uses a basic-authentication token for user-validation. (So in laymen-terms) it requires a -header 'authorization' with its value. But i can't seem to add any custom headeres to my http-request. So is there a solution to that ??

0

There are 0 answers