Problem with setting Authorization header
antonkomarev opened this issue · 3 comments
antonkomarev commented
This code works:
let jsonApi = createResourceLibrary('http://127.0.0.1:8000', {
headers: {
Authorization: `${tokenType} ${accessToken}`,
},
});
This one doesn't send headers when doing request:
let jsonApi = createResourceLibrary('http://127.0.0.1:8000');
jsonApi.headers = {
Authorization: `${tokenType} ${accessToken}`,
};
And I've noticed that first example adds extra header:
'Content-Type': 'application/vnd.api+json',
While second one doesn't do it. And it seems that both examples doesn't use this header in requests.
Chilinot commented
I have the same issue. I cant get the requests to authenticate against the backend because i define the headers after the createResourceLibrary call.
nicklandgrebe commented
Sorry for the delay. I have uploaded the fix for this to master, and will update you when it is released as 1.0.0-beta.4
fconforti commented
@nicklandgrebe any updates for the 1.0.0-beta.4?
Thanks,
F.