You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to add headers to provide a token access to my API. The guide gives this line :
this.datastore.headers = new Headers({'Authorization': 'Bearer ' + accessToken});
and 2 other examples, but they seem to be on the consumer components side. I'd like to avoid specifying headers it in each of my HTTP calls.
First I tried to add it in a "headers" key within the @JsonApiDatastoreConfig decorator, but didn't work.
Then I tried to put it in my Datastore service, in the constructor :
Now something strange, each time I validate my form and check the headers that are sent to the server, it turns out that the "accept" and "Content-type" keys are repeated.
Example, if I submit my form 3 times, I get on the third call :
Does it come from the way I add my header ?
Just for information, when I submit a form, server doesn't return a valid response yet (test purpose), so the app is assumed to be crashed.
Thx for your help
The text was updated successfully, but these errors were encountered:
HennerM
added a commit
to HennerM/angular2-jsonapi
that referenced
this issue
Oct 19, 2016
@supertino7 I'm also trying to do this in the constructor, but unfortunately, at the time the service/provider is initialized, the token isn't available yet and therefore headers are never set. How are you handling this?
Hello,
I'm trying to add headers to provide a token access to my API. The guide gives this line :
this.datastore.headers = new Headers({'Authorization': 'Bearer ' + accessToken});
and 2 other examples, but they seem to be on the consumer components side. I'd like to avoid specifying headers it in each of my HTTP calls.
First I tried to add it in a "headers" key within the @JsonApiDatastoreConfig decorator, but didn't work.
Then I tried to put it in my Datastore service, in the constructor :
Now something strange, each time I validate my form and check the headers that are sent to the server, it turns out that the "accept" and "Content-type" keys are repeated.
Example, if I submit my form 3 times, I get on the third call :
Does it come from the way I add my header ?
Just for information, when I submit a form, server doesn't return a valid response yet (test purpose), so the app is assumed to be crashed.
Thx for your help
The text was updated successfully, but these errors were encountered: