I'm trying to integrate with linkedin but with Authorization
param in the header, I followed the docs and i'm stuck in the last step which is Step 4 — Make authenticated requests
, I'm using JS so i don't know how to add header to IN.API.Raw("/people/~?format=json").result(onSuccess).error(onError);
, So i tried to do it manually with XMLHttpRequest
.
n_url = "https://api.linkedin.com/v1/people/~?format=json";
var gg = new XMLHttpRequest();
gg.open("GET", n_url, true);
gg.setRequestHeader("Access-Control-Allow-Origin", "*");
gg.setRequestHeader("Authorization", "Bearer "+[ACCESS_TOKEN]);
gg.send(null);
but this gives OPTIONS https://api.linkedin.com/v1/people/~?format=json
error in the console in addition to Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
, So is there any way to use IN.API that allows me to add some headers (this will be simple), Or what should i do to fix my manual request, I'm noticing that the sent request is OPTION
not GET
, i searched a lot about that but i didn't get a clear answer.
Any help?