I have the below code in my ajax request.
beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'bearer t-7614f875-8423-4f20-a674-d7cf3096290e') }
- Initially, i need to know the purpose of xhr.setRequestHeader().
while set like above , i receive the console error as
Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.
I searched a lot and so many solutions found, but i didn't understand.
Any one please explain, why we are using this and why this issue occurs and how to resolve this.
Need the easy understanding about this issue, please suggest